From: Dan W. <d4...@ho...> - 2002-10-07 20:28:00
|
Hi, I have been trying to use zipfile.ZipFile() with mode="a" to add files to an archive. However when I try to perform a write, each file simply overwrites the previous one. I have tried exactly the same code in Python 2.2 and it works differently. For instance, in Jython, opening a non-existent zip file with mode="a" creates the file, whereas a runtime error is generated if you perform the same action in Python, which requires the file to be present. If I create the file, open it with mode="a" and write files to the archive, this works fine with Python. Perhaps someone out there can verify that this is indeed a bug, or perhaps I am doing somthing wrong. I have attached some code to explain below. import zipfile #File c:\\test.zip does not exist... file = zipfile.ZipFile("c:\\test.zip", mode="a") #Above, if done in Python, creates a runtime error! #Add first file to archive file.write("c:\\test1.txt") #Add second file to archive file.write("c:\\test2.txt") file.close() #Oh dear, appears that archive now just consists of c:\\test2.txt Dan. _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com |