#49 Setting read EOL

v1.0 (example)
closed
None
5
2014-08-28
2011-08-01
Anonymous
No

Hi,

PySerial API says that the correct way of using readline() is
readline(size=None, eol='\n')

However when I try to use it with parameters I get:
str = s.readlines(eol='\n')
TypeError: readlines() takes no keyword arguments

How can I change default EOL ?

Thanks,
Jakub

Discussion

  • Chris Liechti

    Chris Liechti - 2011-08-04

    On newer Python's, pySerial is inheriting from the io module which does not support this parameter.

    To gain control over new lines, wrap the serial port object using io.TextIOWrapper. This also gives the opportunity to specify the encoding (pySerial just reads 'raw' bytes).

    see also http://docs.python.org/library/io.html#io.TextIOWrapper

    I'll add an other note about this to the docs.

     
  • Chris Liechti

    Chris Liechti - 2011-08-04
    • assigned_to: nobody --> cliechti
    • status: open --> pending
     
  • Chris Liechti

    Chris Liechti - 2014-08-04
    • status: pending --> closed
    • Group: --> v1.0 (example)
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks