newbie question about compression and ascii

Jeff Epler jepler at unpythonic.net
Sun Jan 18 13:31:17 EST 2004


Let's get down to what the problem is:
>>> f = zipfile.ZipFile("/tmp/blah.zip", "w")
>>> f.write(u'\xe0')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/zipfile.py", line 374, in write
    st = os.stat(filename)
UnicodeError: ASCII encoding error: ordinal not in range(128)

Your filenames are Unicode strings, and must contain some characters
that aren't ASCII.  I don't know if ZipFile (or the zip "standard")
defines an encoding for filenames, but it appears not:
	http://www.info-zip.org/pub/infozip/FAQ.html#limits

This might be relevant:
	http://dbforums.com/arch/97/2003/5/773834

Jeff




More information about the Python-list mailing list