From 7c068750b611fe0298dd906bd9dc60cc38a03945 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 2 Feb 2013 12:30:49 +0200 Subject: [PATCH] Fix translating of illegal characters on Windows (issue #6972). --- Lib/zipfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 31000accbb5..9af2986bf9a 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)