Menu

#37 TypeError in SerialException

v2.7
closed
None
5
2015-08-04
2014-10-28
Oleg
No

Trying to catch a SerialException while reading from the serial port, I get

...
File "/usr/lib/python3.4/codecs.py", line 488, in read
newdata = self.stream.read(size)
File "/usr/lib/python3.4/site-packages/serial/serialposix.py", line 480, in read
if e[0] != errno.EAGAIN:
TypeError: 'SerialException' object does not support indexing

In current trunk version this is line 498 in pyserial/serial/serialposix.py which is causing this:

498 if e[0] != errno.EAGAIN:
499 raise SerialException('read failed: %s' % (e,))

I guess it should be
498 if e.errno != errno.EAGAIN:
499 raise SerialException('read failed: %s' % (e,))

Discussion

  • Chris Liechti

    Chris Liechti - 2015-08-04
    • status: open --> closed
     
  • Chris Liechti

    Chris Liechti - 2015-08-04

    fixed in trunk where the exeption is handled differently for python 2.x and python 3.x

     

Log in to post a comment.