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

From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: ValueError: I/O operation on closed file. with python3
Date 2013-06-12 17:44 +0300
References <CA+mfgz1-ywaOLRSV4LBd1fzCvkgHUwE6kLdNPUpiLZzVJX11mA@mail.gmail.com> <kp97qp$v49$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.3115.1371057695.3114.python-list@python.org> (permalink)

Show all headers | 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