New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zipfile.extractall always raises an OSError after successfully unzipping all files #53418
Comments
Tried it with a variety of unencrypted zips. Zipped with WinZip 11.1. Looks like it tries to unzip a second time after it completes the first unzip. Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from zipfile import ZipFile
>>> zip = ZipFile("example_1.zip")
>>> zip.extractall()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/zipfile.py", line 935, in extractall
self.extract(zipinfo, path, pwd)
File "/usr/lib/python2.6/zipfile.py", line 923, in extract
return self._extract_member(member, path, pwd)
File "/usr/lib/python2.6/zipfile.py", line 960, in _extract_member
os.mkdir(targetpath)
OSError: [Errno 17] File exists: '/home/andy/projects/codedropvalidator/testdata/example'
>>> |
Hi! I tried a quick and dirty fix for the zipfile _extract_member method, which basically should fix the problem! So here I create the directory only if it is not already existing, to get those empty directories created inside the zip. zipfile: |
I didn't see this problem in py2.7 and py3k on debian linux. Is this windows specific or this bug has been fixed since py2.7? |
Hi! I haven't tested this in linux or with python 2.7 so can't say for sure.. However I would assume that the main issue is with the zipdate it self (So does it have those empty directories, which at least winzip creates) and then about how does the os.mkdir act with when trying to create already existing folder. Did you try it with the example_1.zip, which has those folders described in the zip centralrecord?? Should I also try it out with linux? -Teemu |
I found that this issue is duplicate with bpo-6050. And the bug has been fixed since 2.6.3. So this issue should be closed. |
Closed as duplicate of bpo-6050. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: