fix json unicode issue in manager
This commit is contained in:
parent
c5dd081216
commit
3c1154923f
2 changed files with 7 additions and 3 deletions
|
@ -148,8 +148,7 @@ def get_config(is_local):
|
|||
logging.info('loading config from %s' % config_path)
|
||||
with open(config_path, 'rb') as f:
|
||||
try:
|
||||
config = json.loads(f.read().decode('utf8'),
|
||||
object_hook=_decode_dict)
|
||||
config = parse_json_in_str(f.read().decode('utf8'))
|
||||
except ValueError as e:
|
||||
logging.error('found an error in config.json: %s',
|
||||
e.message)
|
||||
|
@ -359,3 +358,8 @@ def _decode_dict(data):
|
|||
value = _decode_dict(value)
|
||||
rv[key] = value
|
||||
return rv
|
||||
|
||||
|
||||
def parse_json_in_str(data):
|
||||
# parse json and convert everything from unicode to str
|
||||
return json.loads(data, object_hook=_decode_dict)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue