This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Vhati
Recipients Vhati, ezio.melotti
Date 2013-04-08.03:20:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Python 2.7.4 fails while extracting zip files when 'member' is a unicode path.

Traceback (most recent call last):
    my_zip.extract(item, tmp_folder_path)
  File "D:\Apps\Python274\lib\", line 1024, in extract
    return self._extract_member(member, path, pwd)
  File "D:\Apps\Python274\lib\", line 1057, in _extract_member
    arcname = arcname.translate(table)
TypeError: character mapping must return integer, None or unicode
2.7.3 had no problems because the call to translate() is new.

The following, copied from, will recreate the error.
import string
illegal = ':<>|"?*'
table = string.maketrans(illegal, '_' * len(illegal))

arcname = "hi"
arcname = arcname.translate(table)
# ascii strings are fine

arcname = u"hi"
arcname = arcname.translate(table)
# unicode fails
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
# TypeError: character mapping must return integer, None or unicode

I tried using unicode literals for the illegal string and maketrans underscore arg, but that didn't work. Suggestions?

Here's a link to the doc for translate().
Date User Action Args
2013-04-08 03:20:59Vhatisetrecipients: + Vhati, ezio.melotti
2013-04-08 03:20:59Vhatisetmessageid: <>
2013-04-08 03:20:59Vhatilinkissue17656 messages
2013-04-08 03:20:58Vhaticreate