BadZipfile "file is not a zip file"

Wesley Brooks wesbrooks at
Fri Jan 9 18:06:28 CET 2009

I missed the begining of this thread and so appologise if I'm repeating what
someone else has said!

I had a very similar problem with this error and it turned out it was due to
me moving a file across a socket connection and either not reading it or
writing it in the binary mode, ie open(filename, 'rb') or write(filename,
'wb'). This didn't make any difference on the linux machines (where the
error didn't occur) but did on the windows machines and fixed the problem.



On 09/01/2009, webcomm <ryandw at> wrote:
> On Jan 9, 10:14 am, "Chris Mellon" <arka... at> wrote:
> > This is a ticket about another issue or 2 with invalid zipfiles that
> > the zipfile module won't load, but that other tools will compensate
> > for:
> >
> >
> Looks like I just need to do this to unzip with unix...
> from os import popen
> popen("unzip")
> That works for me.  No idea why I didn't think of that earlier.  I'm
> new to python but should have realized I could run unix commands with
> python.  I had blinders on.  Now I just need to get rid of some bad
> characters in the unzipped file.  I'll start a new thread if I need
> help with that...
> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list