Menu

#98 Serial.readlines seems to be coming from IOBase not FileLike

closed-wont-fix
nobody
None
5
2011-04-02
2010-11-25
Anonymous
No

I just installed pyserial2.5 onto a ArchLinux machine.
When I call readlines on my serial.Serial instance like so:

s = serial.Serial(...)
s.readlines(eol='\r\n')

I get the error: "TypeError: readlines() got an unexpected keyword argument 'eol'"

Both your documentation AND the source code (Serial inherits readlines from FileLike) say that eol is a valid argument! So why doesn't this work??

I then thought I'd better make sure the serial module is being loaded from where I install pyserial 2.5 with the following two tests:

import serial
serial.VERSION # '2.5'
serial.__file__ # /usr/lib/python2.6/site-packages/serial/__init__.py'

I even diff'ed the downloaded copy (in my ~/src/pyserial-2.5/serial) with the installed version in site-packages, but they are definately the same.

HELP!!!

Discussion

  • Anonymous

    Anonymous - 2010-12-28

    We bumped into the same thing also with a Windows machine. The example you described above worked OK with Python version 2.5, but with Python 2.7 it did not work anymore.

    The reason in our case was that with Python 2.5 "import io" did not succeed, but with 2.7 it did. This caused pyserial to inherit the Serial class from "FileLike" in 2.5, but from "IO" in 2.7.

    The IO module apparently does not support the "eol" argument in "readlines".

     
  • Chris Liechti

    Chris Liechti - 2011-03-18

    Starting with pySerial 2.5, it automatically inherits from the IO module when it is available (Python 2.6+). This has the drawback that readline does not have this option but in turn the IO framework can be used for buffering, text processing etc. pySerial also returns byte objects instead of strings in order to be compatible with other file like objects in newer Pythons.

     
  • Chris Liechti

    Chris Liechti - 2011-03-18
    • status: open --> pending-wont-fix
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-wont-fix --> closed-wont-fix
     

Log in to post a comment.

MongoDB Logo MongoDB