Just as an update guys:
Before my zip code featured below I have another piece of code that creates the zip file from a binary string, like this: #f3 = open("Media/Media.zip", "wb") #f3.write(base64.decodestring(MediaBinary)) #f3.close Now, with that code commented out like that so the unzip code is running on the file generated last time the code was run it works fine, but if I try and unzip after the file has been freshly created I get that error, I've even tried placing a 2 second sleep command in between them and still get the problems. Thanks guys, Rob From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Rawlins - Think Blue Sent: 27 June 2007 15:10 To: python-list@python.org Subject: Zip File Woes Hello Guys, I'm having a MASSIVE headache today with zip files, I had it working a while ago but it all seems to have stopped in the past 30 minutes and I can't figure out why. I'm simply trying to write a function that will unzip a file, simple as that. I've currently got this code: Import zipfile zip = zipfile.ZipFile('Media/Media.zip', 'r') unzip(zip) zip.close() def unzip(zip): for name in zip.namelist(): newname = 'Media/%s' % (name) file(newname, 'wb').write(zip.read(name)) Now when I try and run this i get the following error message: File "/usr/lib/python2.4/zipfile.py", line 242, in _RealGetContents raise BadZipfile, "File is not a zip file" zipfile.BadZipfile: File is not a zip file However, if I copy the zip file off the unit client onto my windows box and unzip it and it works absolutely perfectly, all the files are extracted as I would expect, which leads me to think the zip file is fine, and i must just be missing something in my code. Any ideas guys? I'm tearing my hair out here. Rob
-- http://mail.python.org/mailman/listinfo/python-list