Migration Python2 towards Python3 (#4232)

The modified code stays compatible with Python2.
This commit is contained in:
marjorieB
2020-02-15 07:33:25 +01:00
committed by GitHub
parent 88bbdbdc92
commit 840771d189
4 changed files with 32 additions and 32 deletions

View File

@@ -87,9 +87,9 @@ for file in filenames:
try:
doc = xml.dom.minidom.parse(file)
except Exception as ex:
print "============================================"
print "/!\\ Expat doesn't like ", file, "! Error=", type(ex), " (", ex.args, ")"
print "============================================"
print("============================================")
print("/!\\ Expat doesn't like ", file, "! Error=", type(ex), " (", ex.args, ")")
print("============================================")
traverse(file, doc, isChallenge, isGP, isKart, isTrack, isAchievements)

View File

@@ -25,14 +25,14 @@ import sys
if __name__ == "__main__":
if len(sys.argv) < 2:
print "Usage: getpo_authors.py PATH_TO_PO_FILE"
print("Usage: getpo_authors.py PATH_TO_PO_FILE")
sys.exit(-1)
for filename in sys.argv[1:]:
print("Processing file %s" % filename)
f = open(filename, "r")
if not f:
print "Can not find", filename
print("Can not find", filename)
exit
lines = f.readlines()