Super-AIO icon indicating copy to clipboard operation
Super-AIO copied to clipboard

Initial py3 support

Open Jc2k opened this issue 7 years ago • 1 comments

(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 with str()
  • serial's write() only takes bytes - so use b'' 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 a print()

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.

Jc2k avatar May 21 '17 12:05 Jc2k

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 :)

kiteretro avatar May 22 '17 21:05 kiteretro