BadZipfile "file is not a zip file"

Scott David Daniels Scott.Daniels at Acm.Org
Fri Jan 9 13:32:54 EST 2009


webcomm wrote:
> ....  I tried Scott's getzip() function yesterday... I
> stumbled upon it in my searches.  It didn't seem to help in my case,
> though it did produce a different error:  ValueError, substring not
> found.  Not sure what that means.

and in another message webcomm wrote:
 > I ran the diagnostic gadget...
 >
 > archive size is 69888
 > FileHeader at 0
 > CentralDir at 43796
 > EndArchive at 43846

This is telling you that the archive ends at 43846, but the file
is 69888 bytes long (69888 - 43846 = 26042 post-archive bytes).
Have you tried calling getzip(filename, ignoreable=30000)?
The whole point of the function is to ignore the nasty stuff at the
end, but if _I_ had a file with more than 25K of post-archive bytes,
I'd certainly try to figure out if the archive was mis-handled
somewhere along the way.  Byt the way, one reason you cannot find
the archive by looking at the start of the file is that the zip file
format is meant to allow you to append a zip file to another file (such
as an executable) and treat the combination as an archive.

--Scott David Daniels
Scott.Daniels at Acm.Org





More information about the Python-list mailing list