About zipfile on WinXP

rzed jello at comic.com
Mon Jan 2 14:03:35 EST 2006


I create a zip file on my WinXP system, using this function:

<fn>
import zipfile
import os
import os.path

def zipdir(dirname, zfname):
    zf = zipfile.ZipFile(zfname, 'w', zipfile.ZIP_DEFLATED)
    for root, dirs, files in os.walk(dirname):
        for f in files:
            fullname = os.path.join(root, f)
            zf.write(fullname)
    zf.close()
</fn>

The file is created, and, again using zipfile, I can read it and 
extract from it and so on. 

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? 

-- 
rzed



More information about the Python-list mailing list