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


Groups > comp.lang.python > #47823

Re: ValueError: I/O operation on closed file. with python3

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'resp': 0.09; 'def': 0.12; 'bug': 0.12; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'resp:': 0.16; 'subject:closed': 0.16; 'subject:python3': 0.16; 'header:User-Agent:1': 0.23; 'subject:/': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'url:bugs': 0.29; 'needed.': 0.30; 'skip:@ 10': 0.30; 'url:python': 0.33; '(i.e.': 0.33; 'subject:with': 0.35; 'there': 0.35; 'yield': 0.36; 'url:org': 0.36; '8bit%:86': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'received:46': 0.66; 'subject:. ': 0.67; 'otten': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: ValueError: I/O operation on closed file. with python3
Date Wed, 12 Jun 2013 17:44:41 +0300
References <CA+mfgz1-ywaOLRSV4LBd1fzCvkgHUwE6kLdNPUpiLZzVJX11mA@mail.gmail.com> <kp97qp$v49$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 46.211.127.5
User-Agent Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6
In-Reply-To <kp97qp$v49$1@ger.gmane.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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3115.1371057695.3114.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1371057695 news.xs4all.nl 15886 [2001:888:2000:d::a6]:55084
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:47823

Show key headers only | View raw


12.06.13 10:26, Peter Otten написав(ла):
>    @contextmanager
>    def my_urlopen(url):
>        resp = urlopen(url)
>        yield io.TextIOWrapper(resp.fp)

         with urlopen(url) as resp:
             yield io.TextIOWrapper(resp)

Note that last bugfix releases (i.e. 3.3.1) are needed. There was a bug 
with io.TextIOWrapper and HTTPResponse (http://bugs.python.org/issue16723).

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


Thread

Re: ValueError: I/O operation on closed file. with python3 Serhiy Storchaka <storchaka@gmail.com> - 2013-06-12 17:44 +0300

csiph-web