Hi,
I am able to connect to serial ports using the CoolTerm application without any issues.
When I try to run the #open the serial port# portion of Introduction.py in Python, I am coming across the error:
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 7507: invalid start byte".
I assume that this is because all commands are written in ASCII and not utf-8. Any idea how I can get around this?
Unable to open serial port in Python
- roger
- Site Admin
- Posts: 434
- Joined: Fri Apr 24, 2009 12:41 am
- Contact:
Re: Unable to open serial port in Python
Try changing this line in the CoolTerm.py module, in the getData function, on line 253 from
to
This ensures decoding using ASCII when bytes larger than 0x7F are received.
Code: Select all
return DATA.decode()
Code: Select all
return DATA.decode(encoding='ascii')