About zipfile on WinXP

Scott David Daniels scott.daniels at acm.org
Mon Jan 2 22:12:10 CET 2006


rzed wrote:
> I create a zip file on my WinXP system, using this function:
> ... 
> However, WinXP has a "feature" (if that's what it is): if you click 
> on a zip file in explorer, an explorer window opens that shows the 
> contents of the zip file. If I use WinZip or UltimateZip to create 
> the files, this works more-or-less okay, but when I click on the 
> zip file Python creates, no content shows at all (just a blank 
> explorer window). If I explicitly use one of the other zip-handling 
> packages, I can view the python-created file's contents.
> 
> Has anyone else observed this? If not, is there something in the 
> code that I should change to permit XP to view the contents? 

Are you using a name like 'mumble.zip'?  Some identification goes
by extension.  Other possible tests include trying to make a minimal
zip with a tiny file in it.  compare both the binary contents of the
file and any attributes it get through the file system.

Here's an interesting experiment:

1) Make a zip file (original.zip) with one of the apps that "works".
2) Run the following code:
     original = open('original.zip', 'rb')
     copy = open('copy.zip', 'wb')
     copy.write(original.read())
     original.close()
     copy.close()
3) Now see if copy.zip can be opened by clicking.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list