I receive bytes from external device with pyserial in the form:
b'S\rSN 00\rSC 00\rFC 00\rRI 00\rMF 00006643\rTS 0000BA39\rTB 00000000\rCB FFFFFFFF\rCL 002\rI> '
It is done with the code (snippet):
while ser.in_waiting > 0:
output = ser.read(ser.in_waiting)
print(output)
So I expect to print it as text in the form like:
S
SN 00
SC 00
FC 00
RI 00
MF 00006643
TS 0000BA39
TB 00000000
CB FFFFFFFF
CL 002
I>
But when I try to decode it withprint(output.decode()) or print(output.decode('ascii')) I get only part of all (84) characters:
I> 002FFFFF
What is wrong? How to get all the decoded text?
pprint.pprintmight help with debugging problems like this. In this case,from pprint import pprint; pprint(output.decode())-> shows the whole string, in a readable format.