views:

504

answers:

1

I'm using a script importing PySerial to read from COM4

messages I would like to intercept end with a couple of #

so I tried to use

bus.readline(eol='##')

where bus is my connection.

I expected to read like:

  1. *#*3##
  2. *#*3##
  3. *#*3##

Unfortunalyy I found also

  1. *#*1##*1*1*99##

that I expected to read spleetted into 2 lines

  1. *#*1##
  2. *1*1*99##

Clearly readline is not working but why?

+2  A: 

The readline() method in pyserial reads one character at a time and compares it to the EOL character. You cannot specify multiple characters as the EOL. You'll have to read in and then split later using string.split() or re.split()

Kamil Kisiel
resolved using EnhancedSerial into pySerial including readline function re-implemented.
DrFalk3n