Serial port code worked in Python 2 but not 3 - Raspberry Pi Forums


frustrated. trying convert python 2.x app worked fine python 3.x. send many bytes on serial port, snippet.
python 2 serialport.write(chr(0x41)) fine
python 3 serialport.write(b'\x41') not working

send simple message device expecting reply. python2, reply comes in, python 3, dead dodo.
doing wrong. sort of encoding issue?
i've looked @ many examples , getting nowhere.
help...

further info:
first thing did in code send serial command device change default baud rate 9600 115200.
skip , working - sort of.
device returns nak if doesn't understand something.
commands accepted , not.
must have changed in python 3 regarding way data transmitted out appear me characters being transmitted or there odd buffering going on.
extremely frustrating. i'm 'c' programmer trade , can more not work way through problems has got me stumped.


raspberrypi



Comments