[New-bugs-announce] [issue10447] zipfile: IOError for long directory paths on Windows

Sridhar Ratnakumar report at bugs.python.org
Wed Nov 17 20:14:13 CET 2010

New submission from Sridhar Ratnakumar <sridharr at activestate.com>:

When extracting a zip file containing deep hierarchy files, `extractall` throws IOError on Windows - perhaps due to limitation in Windows max path length. Ideally it should be throwing an instance of zipfile.ZipError - so that application can handle it reliably. An IOError can mean a wide range of errors, so it is pointless to catch IOError and ignore it.

To reproduce, run extractall over http://pypi.python.org/packages/source/c/collective.generic.skel/collective.generic.skel-0.1.0.zip using Python 2.6.6 or Python 2.7

> python -c "import zipfile
; f=zipfile.ZipFile('collective.generic.skel-0.1.0.zip'); f.extractall()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python27\lib\zipfile.py", line 923, in extractall
    self.extract(zipinfo, path, pwd)
  File "C:\Python27\lib\zipfile.py", line 911, in extract
    return self._extract_member(member, path, pwd)
  File "C:\Python27\lib\zipfile.py", line 955, in _extract_member
    target = file(targetpath, "wb")
IOError: [Errno 2] No such file or directory: 'C:\\Documents and Settings\\apy\\
My Documents\\Downloads\\collective.generic.skel-0.1.0\\src\\collective\\generic

components: Library (Lib), Windows
messages: 121376
nosy: srid
priority: normal
severity: normal
status: open
title: zipfile: IOError for long directory paths on Windows
type: behavior
versions: Python 2.6, Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list