zipfile.py
M.J.Fisher
m.j.fisher at ex.ac.uk
Wed Dec 13 12:09:18 EST 2000
Hi,
I have been having some trouble with using zipfile.py, I need to unzip
.zip files some created in windows and
some in unix.
I have the following piece of code:
import zipfile
if zipfile.is_zipfile(self.path):
zf = zipfile.ZipFile(self.path, 'r')
for file in zf.namelist():
newFile = open(self.directory+'/'+ file, 'wb')
newFile.write(zf.read(file))
newFile.close()
zf.close()
else:
print 'We cannot process this file'
But when I try and use it I get the following error:
File "fileAgent.py", line 251, in GetFileTypes
item.ProcessZip()
File "fileAgent.py", line 160, in ProcessZip
newFile.write(zf.read(file))
File "/home/sheerkahn3/mjfisher/lib/python2.0/zipfile.py", line 242,
in read
bytes = dc.decompress(bytes)
zlib.error: Error -3 while decompressing: incomplete dynamic bit lengths
tree
I think it may be a problem with trying to unzip zip files created in
unix but I am not sure, I would be grateful for
any help you could give me.
Thanks in advance,
Shelley
More information about the Python-list
mailing list