Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74149 > unrolled thread

Re: error handling when opening files

Started byChris Angelico <rosuav@gmail.com>
First post2014-07-08 15:25 +1000
Last post2014-07-08 15:25 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: error handling when opening files Chris Angelico <rosuav@gmail.com> - 2014-07-08 15:25 +1000

#74149 — Re: error handling when opening files

FromChris Angelico <rosuav@gmail.com>
Date2014-07-08 15:25 +1000
SubjectRe: error handling when opening files
Message-ID<mailman.11617.1404797135.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web