zipfile decompress problems

2006-01-16 Thread Waguy
Hi all,

I am new to python and want to create a process to unzip large numbers of
zip files I get from a SOAP application.  The files all have a ZIP extention
and can be unzipped using WinZip.

However when I try opening the files using zlib or zipfile modules I get the
following error:

Traceback (most recent call last):
  File "", line 1, in -toplevel-
file = zipfile.ZipFile("c:\\chessy.zip", "r")
  File "C:\Python24\lib\zipfile.py", line 210, in __init__
self._GetContents()
  File "C:\Python24\lib\zipfile.py", line 230, in _GetContents
self._RealGetContents()
  File "C:\Python24\lib\zipfile.py", line 242, in _RealGetContents
raise BadZipfile, "File is not a zip file"
BadZipfile: File is not a zip file

The code I used in python was:

import zipfile
file = zipfile.ZipFile("c:\\chessy.zip", "r")

I tried to do the same with a zip file I created using WinZip and it worked
fine.  I have been searching the web for about two days and haven't found
anything helpful.

Can anyone help with this?  I have the zip I can send, however I tried to 
send this message with it attached and it didn't get posted.

Cheers,




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: zipfile decompress problems

2006-01-16 Thread Waguy
I tried that to and it didn't work, got the same message

Thanks though,



"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Waguy wrote:
>
>> import zipfile
>> file = zipfile.ZipFile("c:\\chessy.zip", "r")
>
>
> Use "rb".
> -- 
> Giovanni Bajo
>
> 


-- 
http://mail.python.org/mailman/listinfo/python-list