summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2019-02-25 07:03:28 -0500
committerBradley Sepos <[email protected]>2019-02-25 08:47:38 -0500
commit5bff83c1da2d99da99fab70cb8b9ae13717a4323 (patch)
treedc5db2ecbe150b6d1cba7c2dc6f5e7228a9cee1e /scripts
parente563c0d80618d13acf5a67fbbe69a907ef07a30c (diff)
configure: gtk: make: scripts: Make scripts compatible with Python 3.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create_resources.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/create_resources.py b/scripts/create_resources.py
index 54d1310b6..43cf298d2 100755
--- a/scripts/create_resources.py
+++ b/scripts/create_resources.py
@@ -41,7 +41,7 @@ def start_element_handler(tag, attr):
try:
with open(fname) as fp:
val = json.load(fp)
- except Exception, err:
+ except Exception as err:
print >> sys.stderr, ("Error: %s" % str(err))
elif fname is None:
print >> sys.stderr, ("Error: No such json file %s" % fbase)
@@ -63,7 +63,7 @@ def start_element_handler(tag, attr):
try:
with open(fname) as fp:
val = fp.read()
- except Exception, err:
+ except Exception as err:
print >> sys.stderr, ("Error: %s" % str(err))
sys.exit(1)
elif fname is None:
@@ -74,9 +74,9 @@ def start_element_handler(tag, attr):
val = attr["value"]
if val is not None:
- if isinstance(current, types.DictType):
+ if isinstance(current, dict):
current[key] = val
- elif isinstance(current, types.TupleType):
+ elif isinstance(current, tuple):
current.append(val)
@@ -91,8 +91,9 @@ def resource_parse_file(infile):
parser.CharacterDataHandler = cdata_handler
try:
- parser.ParseFile(infile)
- except ExpatError, err:
+ with open(infile.name, 'rb') as file:
+ parser.ParseFile(file)
+ except ExpatError as err:
print >> sys.stderr, ("Error: %s" % str(err))
return None