Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80967
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; '16,': 0.03; 'binary': 0.07; 'correct.': 0.07; 'alter': 0.09; 'okay': 0.09; 'psf': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'suggest': 0.14; '2.7': 0.14; 'windows': 0.15; '480,': 0.16; 'ah,': 0.16; 'bugs.': 0.16; 'e.errno': 0.16; 'e[0]': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subclass': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'module': 0.19; 'version.': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'install': 0.23; 'faq': 0.24; 'instance,': 0.24; 'module,': 0.24; "shouldn't": 0.24; 'specify': 0.24; 'helpful': 0.24; 'mon,': 0.24; "haven't": 0.24; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; 'handling': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'chris': 0.29; 'points': 0.29; 'see,': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'getting': 0.31; 'comments': 0.31; "skip:' 10": 0.31; 'index,': 0.31; 'minor': 0.31; 'file': 0.32; 'this.': 0.32; 'probably': 0.32; 'interface': 0.32; 'run': 0.32; 'another': 0.32; 'says': 0.33; 'url:python': 0.33; 'entirely': 0.33; 'older': 0.33; 'actual': 0.34; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'raising': 0.36; 'set.': 0.36; 'skip:" 50': 0.36; "didn't": 0.36; 'web,': 0.36; 'thanks': 0.36; 'possible': 0.36; 'url:org': 0.36; 'should': 0.36; 'level': 0.37; 'system,': 0.38; 'confirmed': 0.38; 'nov': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'sure': 0.39; 'how': 0.40; 'read': 0.60; 'then,': 0.60; 'worry': 0.60; 'no.': 0.61; "you're": 0.61; 'address': 0.63; 'name': 0.63; 'myself': 0.63; 'grab': 0.64; 'teaching': 0.64; 'between': 0.67; 'yes': 0.68; 'results': 0.69; 'serial': 0.72; 'felt': 0.74; 'believe,': 0.84; 'subject:system': 0.84; 'response,': 0.91; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=9weIWQQQsjcfbEqsFGhaBMn6XEoe9K1pyoQPkmcGyIQ=; b=KO0rQ3JIec/rymgzxl28WCCARLQuB6uHiO1pB0H+wVIl18GFnuWj15f+Wi1e5HTzMk noXZg8Q12pSdW+XY1TpAJQ5n/LJIFNjkR3bH3ASPaVJMWpdzW3SSiBEKdEMclN22GYcc hxDmk9yA2YwhTynBKr+1jTjRS4t0uHpfIrGinGDUP+5+pnkZXkbjKehjk3RRo3xj8VSr gv6AwRwSPckUf70O6AhncF7aL1D3VT3tSvl7dSJKTYod22wrkHF78mYH37jZ7dvgNqxn usjtxb0jJRDoYZxrvh46OWKI6iWIqhhmstsD4Tjf2EbE5thlDqEFpHHManU7/X6POhtl 5f4g== |
| MIME-Version | 1.0 |
| X-Received | by 10.50.178.212 with SMTP id da20mr19318728igc.34.1416213114175; Mon, 17 Nov 2014 00:31:54 -0800 (PST) |
| In-Reply-To | <54697545.2030207@bellfamily.org.uk> |
| References | <54685C24.9040208@bellfamily.org.uk> <CAPTjJmqbyc7G2AssMA+mPEzmuQhL8=22-3bkEnY2QhTNAf+MNQ@mail.gmail.com> <54697545.2030207@bellfamily.org.uk> |
| Date | Mon, 17 Nov 2014 19:31:54 +1100 |
| Subject | Re: Interrupted system call |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15953.1416213123.18130.python-list@python.org> (permalink) |
| Lines | 83 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1416213123 news.xs4all.nl 2836 [2001:888:2000:d::a6]:35729 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:80967 |
Show key headers only | View raw
On Mon, Nov 17, 2014 at 3:10 PM, Peter Bell <peter@bellfamily.org.uk> wrote: > 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 <peter@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! Correct. The handling of InterruptedError (a subclass of OSError) is what's raising TypeError. > Ah, I understand. I believe, then, that this is from the pyserial module, > fetched from sourceforge. > > 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. Yes and no. It may be possible to alter the code to be 2/3 compatible; for instance, if e.errno is used instead of e[0], it should work in both 2.7 and 3.x. (I haven't confirmed this, though.) But keep reading. > 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. You felt rightly. All you need is... > 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. ... a solution to this. I would suggest looking on PyPI, the Python Package Index, to see what you can get for Python 3. In your case, you may well be in luck: https://pypi.python.org/pypi/pyserial There's a version that claims to work with any Python version (though there's some minor disagreement; the metadata says 2.3-2.7 and 3.0-3.3, but the Windows binaries say 2.4-2.7 and 3.0-3.4). I suspect the "2.7" in the name is actually the version of PySerial, and it's coincidental that that happens also to be a Python version. Since you seem to be on a POSIX system, you shouldn't need to worry about the provided binary installers. Use pip3 to install it for your Python 3, and you should be all set. Now, since the package does claim to support Python 3, any discrepancies between that claim and the actual results you're seeing *are* reportable bugs. But it's entirely possible that using pip to install it will sort all that out, as it'll go and grab the correct version. All the best! ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Interrupted system call Chris Angelico <rosuav@gmail.com> - 2014-11-17 19:31 +1100
csiph-web