We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 70252f8 + 41ff7b9 commit be4bb9fCopy full SHA for be4bb9f
tools/utils.py
@@ -30,6 +30,7 @@
30
from collections import OrderedDict
31
import logging
32
from intelhex import IntelHex
33
+import io
34
35
try:
36
unicode
@@ -367,9 +368,9 @@ def json_file_to_dict(fname):
367
368
fname - the name of the file to parse
369
"""
370
- with open(fname, "r") as file_obj:
371
- return json.loads(file_obj.read().encode('ascii', 'ignore'),
372
- object_pairs_hook=OrderedDict)
+ with io.open(fname, encoding='ascii',
+ errors='ignore') as file_obj:
373
+ return json.load(file_obj, object_pairs_hook=OrderedDict)
374
except (ValueError, IOError):
375
sys.stderr.write("Error parsing '%s':\n" % fname)
376
raise
0 commit comments