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


Groups > comp.lang.python > #74278

Re: error handling when opening files

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <alexjeffburke@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:error': 0.03; 'context': 0.07; 'subject:files': 0.09; 'cc:addr:python-list': 0.11; "didn't,": 0.16; 'subject:handling': 0.16; 'subject:when': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'cc:addr:python.org': 0.22; 'regardless': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'piece': 0.31; 'file': 0.32; 'thanks!': 0.32; 'up.': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'manager': 0.38; 'even': 0.60; 'information': 0.63; 'case?': 0.84; 'vulnerable': 0.84
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:to :cc:content-type; bh=u5XbCuzDtxEBABC1o8lcNUn6uQ189X9GDWIJSKiJLOE=; b=NG+Gax2kevs5EPBygRlv0cTvurg+QQPdEOeQVZq43C5TGEciNyVxwJ1rPFdHsZKod1 qeo3NScgXMiRoX0NBCvqDfJr2ec18EpDi5u+n5Sm1476lAGArphP7VVSXpUzROZhHAo+ AsVVTtFelwJeIdrbv/gg0M6SQn2JOXhwgT6CJP1gv9kfoxLgHq+jjTj/S3EiDmP7jEcx T5MRzYT71pxdS6HykJ9jG5wHE+P0L19CtVjJixIqeUUJcyFkZ8jaUqWSLJIP//zUosAO XpJp6H2nndKfPt618jCt1b3ujChkxZ1J9iR61ONpEKZrhQB5DHlP2/VrvtzDV02kqVCG tczA==
MIME-Version 1.0
X-Received by 10.182.24.38 with SMTP id r6mr50095678obf.10.1404935989109; Wed, 09 Jul 2014 12:59:49 -0700 (PDT)
In-Reply-To <53bbb33b$0$2926$c3e8da3$76491128@news.astraweb.com>
References <mailman.11616.1404796682.18130.python-list@python.org> <53bbb33b$0$2926$c3e8da3$76491128@news.astraweb.com>
Date Wed, 9 Jul 2014 21:59:49 +0200
Subject Re: error handling when opening files
From Alex Burke <alexjeffburke@gmail.com>
To "Steven D'Aprano" <steve@pearwood.info>
Content-Type text/plain; charset=UTF-8
Cc "python-list@python.org" <python-list@python.org>
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.11712.1404935998.18130.python-list@python.org> (permalink)
Lines 8
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404935998 news.xs4all.nl 2885 [2001:888:2000:d::a6]:40592
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74278

Show key headers only | View raw


> Interestingly, did you know that even *closing* a file can fail?

No I didn't, interesting piece on information for sure! I thought close() is
usually made to always succeed regardless if it actually hosed up. Any
idea what the context manager will do in that case? (I ask as that
else-with form looks vulnerable in that case but may not be).

Thanks!

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

error handling when opening files Alex Burke <alexjeffburke@gmail.com> - 2014-07-08 01:49 +0200
  Re: error handling when opening files Marko Rauhamaa <marko@pacujo.net> - 2014-07-08 11:30 +0300
  Re: error handling when opening files Steven D'Aprano <steve@pearwood.info> - 2014-07-08 09:00 +0000
    Re: error handling when opening files Chris Angelico <rosuav@gmail.com> - 2014-07-08 20:35 +1000
    Re: error handling when opening files Alex Burke <alexjeffburke@gmail.com> - 2014-07-09 21:59 +0200
  Re: error handling when opening files wxjmfauth@gmail.com - 2014-07-08 02:38 -0700

csiph-web