Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74149
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.012 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:error': 0.03; 'style.': 0.09; 'subject:files': 0.09; 'wrong,': 0.09; 'cc:addr :python-list': 0.11; '"file': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ioerror': 0.16; 'open()': 0.16; 'subject:handling': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'alex': 0.19; 'preferred': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'file.': 0.24; 'cc:2**0': 0.24; 'possibly': 0.26; 'second': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'possibility': 0.29; 'errors': 0.30; 'message-id:@mail.gmail.com': 0.30; 'catching': 0.31; 'occurs': 0.31; 'file': 0.32; 'open': 0.33; 'maybe': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'two': 0.37; 'does': 0.39; 'read': 0.60; "you're": 0.61; 'times': 0.62; 'places': 0.64; 'between': 0.67; 'jul': 0.74; 'distinguish': 0.84; 'reading,': 0.84; '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=F6WkqlEugtpqahQPeGQumt6tS/xWBdXAzKJfJFWs94k=; b=hnImhCfQdWEvO/eUDTmYU6UN7BxcvtxtMH4C0dra2rpyVN0QkEi+SBr3PAF8bCcMvR bUqWiP0nJj3PTuUocWLKfauLjJ0YyedL8BlhIDX4ZqoJB3QgdyFOyGgsgIuVBvcrk8ri x8+su858n0HuXFGmpT6Kw0LWY2pR4Gu4JLEVJ81LotYPSs7JcAmpWCdQqMPqCihdP9pT nOqNtSirQsBdDp6FT0ekkD3xqXCeYaNKUHRE6G/chuuBDkGE92HeaIkuFcZVAbxVTLgx hKi/G2QPbhN9zpugmyARVsNG8+HVrmFTTKkjw9L5fmAp76xgIp4suIIFmhYjxJ3PSu+n Ct1A== |
| MIME-Version | 1.0 |
| X-Received | by 10.221.4.66 with SMTP id ob2mr19471964vcb.28.1404797126886; Mon, 07 Jul 2014 22:25:26 -0700 (PDT) |
| In-Reply-To | <CABT47B+r=Vh+6x6pjj4+6Bko-xXjc62q0TKS=PQBbiu8GyPwsA@mail.gmail.com> |
| References | <CABT47B+r=Vh+6x6pjj4+6Bko-xXjc62q0TKS=PQBbiu8GyPwsA@mail.gmail.com> |
| Date | Tue, 8 Jul 2014 15:25:26 +1000 |
| Subject | Re: error handling when opening files |
| 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.11617.1404797135.18130.python-list@python.org> (permalink) |
| Lines | 14 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1404797135 news.xs4all.nl 2842 [2001:888:2000:d::a6]:49139 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74149 |
Show key headers only | View raw
On Tue, Jul 8, 2014 at 9:49 AM, Alex Burke <alexjeffburke@gmail.com> wrote: > The reason I preferred the second was in addition to catching the > IOError when attempting the open() if the file does not exist I > thought I was accounting for the possibility en error occurs while > reading data out of the file. If that's what you're expecting, then your message is wrong, because you say "file never opened" - but you possibly DID open it, and maybe read something from it. The choice between the two forms should be based on whether you want to distinguish between errors on opening and errors on reading, or conflate them as "file unreadable". There are times and places for each style. ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: error handling when opening files Chris Angelico <rosuav@gmail.com> - 2014-07-08 15:25 +1000
csiph-web