[Python-bugs-list] [ python-Bugs-412214 ] ZipFile constructor leaves files open
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 29 Mar 2001 07:40:38 -0800
Bugs item #412214, was updated on 2001-03-29 07:40
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=412214&group_id=5470
Category: Python Library
Group: None
Status: Open
Priority: 5
Submitted By: Jens Quade (snejsource)
Assigned to: Nobody/Anonymous (nobody)
Summary: ZipFile constructor leaves files open
Initial Comment:
During the construction of a ZipFile object, a
file is opened and assigned to self.fp.
If anything goes wrong, i.e. the file is not a zipfile,
it is not closed explicitly.
On Windows, this does not work:
import zipfile, os
filename="test.zip" # it's a broken one
try:
zf=zipfile.ZipFile(filename)
zf.close()
finally:
os.unlink(zipfile)
=> OSError: [errno 13] Permission denied "test.zip"
(on Unix, the file stays open too, but unlink doesn't
fail)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=412214&group_id=5470