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: 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: <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 To: "Steven D'Aprano" Content-Type: text/plain; charset=UTF-8 Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 > 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!