Article 4SMAA Python EOL marker serial.read

Python EOL marker serial.read

by
RonHof
from LinuxQuestions.org on (#4SMAA)
I'm trying to read data from a serial port:
Code:ser = serial.Serial(
port='/dev/ttyUSB0',
baudrate = 4800,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS,
timeout=1)and

Code: Str = ser.read(8)
print (Str)I expected to see xxxx.xxb'\r'
but what I seem to be getting is b'xxxx.xx\r'
It seems to be splitting the EOL marker some how. I'm asssuming that b'\r' is old fashioned carriage return and has the same effect as b'\n' [new line] I'm completely baffled. Any suggestions?latest?d=yIl2AUoC8zA latest?i=MGHk4IaJWtU:r3D7ktFgT0A:F7zBnMy latest?i=MGHk4IaJWtU:r3D7ktFgT0A:V_sGLiP latest?d=qj6IDK7rITs latest?i=MGHk4IaJWtU:r3D7ktFgT0A:gIN9vFwMGHk4IaJWtU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments