jminardi / mecode

GCode for all
MIT License
221 stars 61 forks source link

Fix Python 2 / Python 3.7 compatibility. #68

Closed DerAndere1 closed 5 years ago

DerAndere1 commented 5 years ago

Fixes Python2 / 3 compatibility with direct_write=True and gives example in the readme. Clearify documentation regarding importance of g.teardown(). See issue #66 and issue #67

DerAndere1 commented 5 years ago

Looks like your Travis checks run tests with python 3.4 and 3.5 . Consider updating to Python 3.6 or 3.7. Also, I suspected that the AttributeError during the travis check is due to an ok-message that is hardcoded in the unit-test as a text string 'ok\n', but I could not find that in the code. With a real serial connection the received message from a printer that has to be processed by the _read_worker would be the bytes-object b'ok\n' in Python 3. That is why I think line = decode2to3(s.readline()) in the _read_worker is correct. With Python 3 that line would translate to line = s.readline().decode().

jminardi commented 5 years ago

Thanks for this!