BadZipfile "file is not a zip file"

Wesley Brooks wesbrooks at gmail.com
Fri Jan 9 12:06:28 EST 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.

Cheers,

Wes

On 09/01/2009, webcomm <ryandw at gmail.com> wrote:
>
> On Jan 9, 10:14 am, "Chris Mellon" <arka... at gmail.com> 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:
> >
> > http://bugs.python.org/issue1757072
>
> Looks like I just need to do this to unzip with unix...
>
> from os import popen
> popen("unzip data.zip")
>
> 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...
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090109/187553a8/attachment-0001.html>


More information about the Python-list mailing list