This utility is for fixing zip files affected by this bug: http://python.org/sf/679953 When creating a zip file over 2GB in size with the zipfile.py in Python 2.3.4 or earlier, an error will occur when packing file sizes. The method used for writing a zipfile using the 'w' mode is the following: Create the file:: self.fp = open(fn, 'w') For each file added:: # create template ZipInfo zinfo = ZipInfo(<>) zinfo.header_offset = self.fp.tell() # Write it to the out file self.fp.write(zinfo.FileHeader()) # Remember where the ZipInfo is zinfo.file_offset = self.fp.tell() # Write the compressed data # Fill in the real ZipInfo zinfo.CRC = <> zinfo.compress_size = <> zinfo.file_size = <> here = self.fp.tell() # Seek back to the ZipInfo # Fill in the missing bits # Seek back to current position self.fp.seek(zinfo.header_offset + 14, 0) self.fp.write(<>) self.fp.seek(position, 0) # Add for later self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo On close:: pos1 = self.fp.tell() for zinfo in self.filelist: # write a centdir entry for this zinfo pos2 = self.fp.tell() # write an end-of-zip-archive It is the final step that fails, so in order to fix a broken zip file we must be able to reconstruct self.filelist from a file with a corrupt central directory.