Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'redirected': 0.07; 'instance.': 0.09; 'sure,': 0.09; 'cc:addr:python-list': 0.11; 'builtins.': 0.16; 'eof': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ioerror,': 0.16; 'mean,': 0.16; 'ought': 0.16; 'rights,': 0.16; 'wrote:': 0.18; 'input': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'mon,': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply- To:1': 0.27; 'idea': 0.28; 'chris': 0.29; 'am,': 0.29; 'raise': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'url:python': 0.33; 'running': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'url:org': 0.36; 'error.': 0.37; 'remote': 0.38; 'url:library': 0.38; 'sure': 0.39; 'read': 0.60; 'url:3': 0.61; "you'll": 0.62; 'anything.': 0.68; 'jul': 0.74; 'fail.': 0.84; 'to:none': 0.92; 'imagine': 0.93 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=pEHXnQrh6Z9MFnHPrrizbGmLC011DKR+zKE47swZPOg=; b=a8vZsYwuFKgIYgbHwwnYwdujvdd7v4f2WbMKqRcXCNb+5Hcp0nMhSEiJG0PcG45pFz 63NoIMkAqGFHyZa/800R339U9VPxpwJA5VLWn2Dl1roJyh38whFlK6qSL1lG8KsOF8dm dU/OzqlibeC8TRRRmWFzoeNzR5tUxKZ2Oi/qeqqP8cttWywsgn3GPF2c/8OCYJqEayME de3OklNQSztBnrRSdOJ/RTFVHGnIq7np0SzNjNkwPebIfi2BrgI0lZiP8Pd2iU9CXsNP rtz46QXZyS1+v0F5jv7EP4AOF/LFIK0acuE/5SILDisVYOTpQwqjPkfZd+NT0f1f8ZOS 1kYA== MIME-Version: 1.0 X-Received: by 10.58.127.130 with SMTP id ng2mr1120918veb.64.1404748399278; Mon, 07 Jul 2014 08:53:19 -0700 (PDT) In-Reply-To: <53bac097$0$29995$c3e8da3$5496439d@news.astraweb.com> References: <53ba11fc$0$29985$c3e8da3$5496439d@news.astraweb.com> <53ba538d$0$2926$c3e8da3$76491128@news.astraweb.com> <53bac097$0$29995$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 8 Jul 2014 01:53:19 +1000 Subject: Re: open() and EOFError From: Chris Angelico Cc: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404748401 news.xs4all.nl 2955 [2001:888:2000:d::a6]:35382 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74119 On Tue, Jul 8, 2014 at 1:45 AM, Steven D'Aprano wrote: > On Mon, 07 Jul 2014 22:19:20 +1000, Chris Angelico wrote: > >> It's possible for input() to raise IOError, if I'm not mistaken; >> consider redirection, for instance. > > What indirection? Do you mean, if built-in input() has been monkey- > patched? Well, sure, but in that case it could do anything. I'm only > concerned with the builtins. Otherwise, I have no idea what you mean by > that. > > https://docs.python.org/3/library/functions.html#input I said redirection, not indirection, and I was thinking of OS-level changes. If input() is actually reading from some file/device, then any error that that could raise could come up from reading from stdin. Imagine if your script is running with input redirected from a file on a dodgy remote mount, and the far end goes down - at some point, you'll attempt to read and fail. I'm not sure that you'll see EOF then; by rights, you ought to see some other error. ChrisA