[issue10301] Zipfile cannot be used in "with" Statement

t.steinruecken report at bugs.python.org
Wed Nov 3 22:28:58 CET 2010


New submission from t.steinruecken <t.steinruecken at service4every1.de>:

Using a ZipFile as a "with"-context dosnt work
(Im using the standard Ubuntu version of Python3.1)

Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from zipfile import ZipFile
>>> with ZipFile("test.zip","w") as z:
...     z.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'ZipFile' object has no attribute '__exit__'
>>>

----------
components: Extension Modules
messages: 120346
nosy: t.steinruecken
priority: normal
severity: normal
status: open
title: Zipfile cannot be used in "with" Statement
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10301>
_______________________________________


More information about the Python-bugs-list mailing list