Many thanks for your helpful response, Chris.
On 17/11/14 06:13, Chris Angelico wrote:
On Sun, Nov 16, 2014 at 7:11 PM, Peter Bell <pe...@bellfamily.org.uk> wrote:
File "/usr/lib/python3.4/site-packages/serial/serialposix.py", line 480,
in read
if e[0] != errno.EAGAIN:
TypeError: 'InterruptedError' object is not subscriptable
=====================================================================
I'm not sure how to address the 'InterruptedError'. Can it/should it be
masked at the user code level with a 'try:' block? Or is there another way
to deal with it?
At this stage, you're not getting it, because of the cascaded error,
so that's the thing to deal with.
Okay - I was just thinking that if the 'InterruptedError' didn't occur,
then the 'TypeError' would never be exposed!
I presume that the subsequent error (TypeError) indicates some fault in the
system level library. I'm not sure where/how to report this.
Not system-level. According to the traceback, that's coming from line
480 of something in site-packages, which probably means it was
installed with pip or equivalent. Do you know where you got hold of
this module from? That's who to report this to.
Ah, I understand. I believe, then, that this is from the pyserial
module, fetched from sourceforge.
It's trying to retrieve the errno from the exception. I suspect the
code was written for Python 2, and you're using it with Python 3. It's
probably possible to shorten/simplify the code somewhat.
I see, now, that the sourceforge download does specify
'pyserial-2.7.tar.gz' and, yes, I'm working in Python 3. I see, from
other comments around the web, that I'm not the only person to be
attempting to use this module with 3.
Given that pyserial is for 2.7, it is probably unreasonable to report
errant behaviour when run on Python 3.
I'm teaching myself (and the kids, as I go) Python and felt, rightly or
wrongly, that it would be better to start with Python 3, rather than
learning the older Python 2.x.
Is there a better way to interface to a serial port from Python 3? I've
found a reference in the PSF 3.3.6 FAQ which points to pyserial on
sourceforge.
--
-------------------------------------------------------------------
Peter Bell Mob: +63 (0) 9287 340 343
Tagum City, Philippines. Tel: +63 (0) 84 216 9037
email/msn: pe...@bellfamily.org.uk Tel: +63 (0) 84 308 0002
--
https://mail.python.org/mailman/listinfo/python-list