Reputation: 67
import serial
s = serial.Serial(port = 'Com3', 9600, timeout = 2)
data = s.readline().decode().rstrip("\r\n")
So basically when I try to read the data I get the error.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 20: invalid start byte
From the documentation of the instrument I am trying to communicate with. the data is in the form: ..ss3422/34/54--1.8E+03<,>…..0.7E+03<,...1.71E-09<,<√.<*.<
Upvotes: 0
Views: 1145
Reputation: 67
I was able to fix the problem by changing to encoding = "ISO-8859-1".
Upvotes: 1