diff options
author | Neil <nyamatongwe@gmail.com> | 2014-04-17 12:26:44 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-04-17 12:26:44 +1000 |
commit | 96f22b3cd364c4cbcb0686ed7f74fc4aebceedd9 (patch) | |
tree | 81e462eb100d59c03ab8f6409aa154af7b562647 /scripts/ScintillaData.py | |
parent | a303b404e82cd8d435efe7a726d74fb10a67cf6f (diff) | |
download | scintilla-mirror-96f22b3cd364c4cbcb0686ed7f74fc4aebceedd9.tar.gz |
Fix Python 3.x compatibility.
Diffstat (limited to 'scripts/ScintillaData.py')
-rw-r--r-- | scripts/ScintillaData.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/ScintillaData.py b/scripts/ScintillaData.py index bb21c2256..f9c7718bf 100644 --- a/scripts/ScintillaData.py +++ b/scripts/ScintillaData.py @@ -30,7 +30,7 @@ from __future__ import with_statement -import datetime, glob, os, textwrap +import codecs, datetime, glob, os, sys, textwrap import FileGenerator @@ -118,7 +118,7 @@ def FindPropertyDocumentation(lexFile): def FindCredits(historyFile): credits = [] stage = 0 - with open(historyFile) as f: + with codecs.open(historyFile, "r", "utf-8") as f: for l in f.readlines(): l = l.strip() if stage == 0 and l == "<table>": @@ -136,7 +136,7 @@ def FindCredits(historyFile): if credit: credit += " " credit += name + " " + url - credits.append(credit.decode("utf-8")) + credits.append(credit) return credits def ciCompare(a,b): @@ -219,4 +219,7 @@ if __name__=="__main__": subsequent_indent=" ")) print("Credits:") for c in sci.credits: - print(" " + c.encode("utf-8")) + if sys.version_info[0] == 2: + print(" " + c.encode("utf-8")) + else: + sys.stdout.buffer.write(b" " + c.encode("utf-8") + b"\n") |