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

Serhiy Storchaka storchaka at gmail.com
Wed Jun 12 10:44:41 EDT 2013


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).





More information about the Python-list mailing list