On Mon, Nov 16, 2009 at 7:15 AM, Sander Sweers <sander.swe...@gmail.com> wrote:
> This triggered my to dig into this a bit. This is not fixed untill > python 3.1 but seems easilly added to the ZipFile class. My attempt to > backport this from python 3.1's gzip.py below seems to work. > > Greets > Sander > > import gzip > > class myGzipFile(gzip.GzipFile): > def __enter__(self): > if self.fileobj is None: > raise ValueError("I/O operation on closed GzipFile object") > return self > > def __exit__(self, *args): > self.close() You might want to report this as a bug against 2.6 and submit this change as a proposed fix. It's easy to do, see http://www.python.org/dev/patches/ You could submit your change right in the body of the report if you don't want to make a diff file. You could suggest an update to the docs as well. Kent _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor