newbie question about compression and ascii

Jeff Epler jepler at
Sun Jan 18 19:31:17 CET 2004

Let's get down to what the problem is:
>>> f = zipfile.ZipFile("/tmp/", "w")
>>> f.write(u'\xe0')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/", 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:

This might be relevant:


More information about the Python-list mailing list