python zipfile v. native unzip

Tim Chase python.list at tim.thechases.com
Wed Feb 1 13:03:38 EST 2012


On 01/31/12 07:41, Jason Friedman wrote:
> Does Python 2.7's zipfile module use its own algorithm or does it
> leverage the zip/unzip libraries that exist on the host?  I ask
> because my host's native unzip program cannot handle files that, when
> unzipped, are larger than 2GB.  Will using Python 2.7 get around this
> limitation?

According to:

http://hg.python.org/cpython/file/5395f96588d4/Lib/zipfile.py#l669

I'm guessing that the ZIP64_LIMIT references the 2GB limit, and 
Python's zipfile module requires you to instantiate with

   zf = ZipFile(..., allosZip64=True)


The ZIP64_LIMIT = (1 << 31) - 1  which is 2GB.  It appears this 
was added in revision fd412a00a07d:

   Patch #1446489 (zipfile: support for ZIP64)

which seems to have been implemented back in at least Python 2.5.

-tkc





More information about the Python-list mailing list