Skip to content

Commit

Permalink
Make the missing-file warning less alarming when loading JSON data (#372
Browse files Browse the repository at this point in the history
)
  • Loading branch information
chrisib authored Aug 10, 2024
1 parent 4c71d4b commit b3035e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion software/firmware/file_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import errno
import os
import json

Expand Down Expand Up @@ -36,7 +37,10 @@ def load_json_file(filename, mode="r") -> dict:
print(f"Unable to parse JSON data from {filename}: {e}")
return {}
except OSError as e:
print(f"Unable to read JSON data from {filename}: {e}")
if e.errno == errno.ENOENT:
print(f"/{filename} does not exist. Using default settings")
else:
print(f"Unable to open {filename}: {e}")
return {}


Expand Down

0 comments on commit b3035e0

Please sign in to comment.