Super-AIO
Super-AIO copied to clipboard
Initial py3 support
(DISCLAIMER: I haven't been able to test this on py2.7 yet).
I'm creating a buildroot based image for my GBZ's. It has py3 for some asyncio code. So I ideally need py3 for this too rather than having both installed. It's nearly working out of the box - only a couple of classes of changes needed:
-
ConfigParser.set()
only takes strings under py3 - so cast ints withstr()
- serial's
write()
only takes bytes - so useb''
strings - serial's readlines() returns bytes, and
rstrip()
doesnt like bytes. so get python3 strings with.decode()
- There is a single
print
that needs to be aprint()
Of these the only one that might be a headache on py2.7 is .decode()
- its going to return unicode
rather than a str
. But it looks like its passed right into int()
so i don't believe thats a problem for running on both 2 and 3.
Nice, good idea :) Apologies the code isn't very neat or well thought out, I plan to eventually move this all into C++ so that the OSD service is able to do all this interaction and save some resources. I will try this out in the next few days and merge if all is well on the original versions :)