'pyserial response unicodeDecodeError
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<,<√.<*.<
Solution 1:[1]
I was able to fix the problem by changing to encoding = "ISO-8859-1".
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | nkosi.nuz |