BadZipfile "file is not a zip file"

John Machin sjmachin at lexicon.net
Fri Jan 9 21:48:57 CET 2009


On Jan 10, 5:32 am, Scott David Daniels <Scott.Dani... at Acm.Org> wrote:
> 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,

Not quite. """In a "normal" uncommented archive, EndArchive_pos + 22
==
archive_size."""

> 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.

Me too. Further, if I wasn't "ever diplomatic" :-), I wouldn't be
calling software (or people!) that blithely ignored 25kb of
unexplained data "forgiving" ... some other f-words, perhaps.

>  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.Dani... at Acm.Org




More information about the Python-list mailing list