[issue9172] zipfile.extractall always raises an OSError after successfully unzipping all files

Teemu Rytkönen report at bugs.python.org
Sun Jul 25 20:34:14 CEST 2010


Teemu Rytkönen <teemu.rytkonen at gmail.com> added the comment:

Hi!
I encountered the same problem and I debugged it a bit..
I think it not doing the entire unzipping again, but the problem is that the winzip packaged zip actually contains all file and directory entries and it fails trying to create already existing directory (because the dir has been created for the files that are in it).

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:
959:        if member.filename[-1] == '/':
<add>           if not os.path.isdir(targetpath):
960:                os.mkdir(targetpath)

----------
nosy: +terytkon
versions: +Python 2.6

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


More information about the Python-bugs-list mailing list