pyserial and end-of-line specification

F S sonnichs at gmail.com
Fri Jul 14 21:04:59 EDT 2017


I just started using Python and I am writing code to access my serial port using pyserial. I have no problem with unix based text coming in the stream using a LF (0x0A) record separator. I also am using unblocked IO. However I have some sensor devices that use the windows CRLF (0x0A,0x0D) record separators and also a 0x03 and 0x02 (stx,etx) framing so I need to change the EOL (end of line) specfier in order to get the pyserial readline to so this.

I read the doc page for pyserial and they allude to using TextIOWrapper: to accomplish this however the example is very unclear and I could not find better information on the IO page.

I would appreciate any advice on how to block the records using "x0Ax0D" and "x03".

Thanks
Fritz



More information about the Python-list mailing list