Hi, I am using the zipfile in Python 2.4 to extract files from existing zips. It appears to work but the files extracted are corrupt. Here is my code :
import zipfile import os, sys , shutil epath = "c:/ziptest/" fil = "J:/archives/xzips/duplicates/gothicfence_1470.zip" ferr = file((epath + "/errlog.txt"),"w") print "Extracting to ",epath try: if zipfile.is_zipfile(fil): z = zipfile.ZipFile(fil,"r") nmes = z.namelist() for i in nmes: fn = os.path.split(i)[1] print "...",fn dta = z.read(i) if len(dta) >0 : enam = epath + fn fo = file(enam,"wb") fo.write(z.read(i)) fo.flush() fo.close() except: myerr = fil +"," + str(sys.exc_info()[1]) +"\n" ferr.write(myerr) ferr.close() any ideas ? thanks -- http://mail.python.org/mailman/listinfo/python-list