From: Serhiy Storchaka Date: Sat, 2 Feb 2013 10:30:49 +0000 (+0200) Subject: Fix translating of illegal characters on Windows (issue #6972). X-Git-Tag: v2.7.4rc1~164^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c068750b611fe0298dd906bd9dc60cc38a03945;p=python Fix translating of illegal characters on Windows (issue #6972). --- diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 31000accbb..9af2986bf9 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -5,6 +5,7 @@ import struct, os, time, sys, shutil import binascii, cStringIO, stat import io import re +import string try: import zlib # We may need its compression method @@ -1052,7 +1053,7 @@ class ZipFile(object): # filter illegal characters on Windows if os.path.sep == '\\': illegal = ':<>|"?*' - table = str.maketrans(illegal, '_' * len(illegal)) + table = string.maketrans(illegal, '_' * len(illegal)) arcname = arcname.translate(table) targetpath = os.path.join(targetpath, arcname)