mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-18 22:56:31 +00:00
Fix severals things with json (#22)
This commit is contained in:
parent
6623ec9bbc
commit
85ffba90b2
@ -77,9 +77,10 @@ def get_local_ip(loop):
|
|||||||
def write_json_file(jsonfile, data):
|
def write_json_file(jsonfile, data):
|
||||||
"""Write a json file."""
|
"""Write a json file."""
|
||||||
try:
|
try:
|
||||||
|
json_str = json.dumps(data, indent=2)
|
||||||
with open(jsonfile, 'w') as conf_file:
|
with open(jsonfile, 'w') as conf_file:
|
||||||
conf_file.write(json.dumps(data))
|
conf_file.write(json_str)
|
||||||
except OSError:
|
except (OSError, json.JSONDecodeError):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user