Python zipfile module erroneously thinks I have a zipfile that spans multiple disks, throws BadZipfile error

python-2.7, zip

Solution

I get the same error on a similar file although I am using python 3.4

Was able to fix it by editing line 205 in zipfile.py source code:

if diskno != 0 or disks != 1:
    raise BadZipFile("zipfiles that span multiple disks are not supported")

to:

if diskno != 0 or disks > 1:

Hope this helps

Problem

I have a 1.4GB zip file and am trying to yield each member in succession. The zipfile module keeps throwing a BadZipfile exception, stating that "zipfile.BadZipfile: zipfiles that span multiple disks are not supported". Here is my code: ``` import zipfile def iterate_members(zip_file_like_object): zflo = zip_file_like_object assert zipfile.is_zipfile(zflo) # Here is where the error happens. # If I comment out the assert, the same error gets thrown on this next line: with zipfile.ZipFile(zflo) as zip: members = zip.namelist() for member in members: yield member fn = "filename.zip" iterate_members(open(fn, 'rb')) ``` I'm using Python 2.7.3. I tried on both Windows 8 and ubuntu with the same result. Any help very much appreciated.

Original source