From d66e2b33a03da4975720e0c85311e909eb4c3e42 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Wed, 28 May 2014 10:35:32 +0100 Subject: Fix running pydiff.py under Python 2.7 --- Test/pydiff.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Test/pydiff.py') diff --git a/Test/pydiff.py b/Test/pydiff.py index 407fe251..e42153a2 100644 --- a/Test/pydiff.py +++ b/Test/pydiff.py @@ -75,7 +75,8 @@ def preProcess(openFile, stripTrailingCR=False, ignoreAllSpace=False): # newline characters because this will create a mess when outputting the # diff. Is this the right behaviour? deleteChars=' \t' - translationTable = str.maketrans('','', deleteChars) + if sys.version_info.major >= 3: + translationTable = str.maketrans('','', deleteChars) copy = [ ] for line in original: @@ -86,7 +87,10 @@ def preProcess(openFile, stripTrailingCR=False, ignoreAllSpace=False): newLine = newLine[:-2] + '\n' if ignoreAllSpace: - newLine = newLine.translate(translationTable) + if sys.version_info.major >= 3: + newLine = newLine.translate(translationTable) + else: + newLine = newLine.translate(None, deleteChars) copy.append(newLine) -- cgit v1.2.3