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

2013-06-12 Thread Serhiy Storchaka
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

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

2013-06-12 Thread Adam Mercer
On Wed, Jun 12, 2013 at 2:26 AM, Peter Otten <__pete...@web.de> wrote: > Applying these findings to your script: > > from contextlib import contextmanager > try: > # python-2.x > from urllib2 import urlopen > from ConfigParser import ConfigParser > > @contextmanager > def my_urlopen(url)

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

2013-06-12 Thread Peter Otten
Adam Mercer wrote: > Hi > > I'm trying to update one of my scripts so that it runs under python2 > and python3, but I'm running into an issue that the following example > illustrates: > > $ cat test.py > try: > # python-2.x > from urllib2 import urlopen > from ConfigParser import ConfigPar