Menu

#19 readline() newline character

closed
nobody
None
5
2009-07-21
2008-10-29
Anonymous
No

win32, python 2.5.2

I could not find a further definition of the newline character for pySerial.readline() but I can tell it is not ASCII <CR> (0x0D).

Maybe you could point that out on the intro page or possibly make the character configurable.

See also:
http://en.wikipedia.org/wiki/Newline

Another thing I noticed (unrelated):
Apparently it takes some time until changes to the port take effect, possibly due to the JavaComm layer. I work around with a time.sleep(0.5) but of course this is machine-dependant.

Thanks for your software!

Discussion

  • Nobody/Anonymous

    def readline(self, size=None, eol='\n'):
    """read a line which is terminated with end-of-line (eol) character
    ('\n' by default) or until timeout"""
    ...

     
  • Chris Liechti

    Chris Liechti - 2009-07-21

    the readline function has an "eol" parameter which is set to \n by default. fresh docs are on their way.

    delays: yes. i've also noticed higher delays when setting control lines on a USB/serial converter compared to the internal serial port. but adding sleeps in the pyserial code doesn't seem sensible. it's better when the application does this when required.

     
  • Chris Liechti

    Chris Liechti - 2009-07-21
    • status: open --> closed
     

Log in to post a comment.