summaryrefslogtreecommitdiff
path: root/settings.py
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@simplelittledream.com>2022-10-31 15:17:09 -0400
committerJacob McDonnell <jacob@simplelittledream.com>2022-10-31 15:17:09 -0400
commitb2e6cdde266260a525ef80147dacbcd2ada3a985 (patch)
treec1c40d6fbba8d53889040bffb22e46c58b51b4c5 /settings.py
parent4681ebe60b5020c63c58034ad3072c0c5e3ca940 (diff)
Better organization of codeporting-to-pico
Diffstat (limited to 'settings.py')
-rw-r--r--settings.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/settings.py b/settings.py
index c5ed5c7..e94dbe2 100644
--- a/settings.py
+++ b/settings.py
@@ -1,14 +1,14 @@
import json
+from logging import exception
-settingsJSON = open('settings.json')
+def getSettings(settingSection):
+ try:
+ settingsJSON = open("settings.json", "r")
+ except FileNotFoundError:
+ exception("settings.json not found make sure it exists in this folder")
-settings = json.load(settingsJSON)
+ settings = json.load(settingsJSON)
+ settingsJSON.close()
-calendars = settings["calendars"]
-weather = settings["weather"]
-news = settings["news"]
-modules = settings["modules"]
-general = settings["general"]
-lineWidth = settings["general"]["Line Width"]
+ return settings[settingSection]
-settingsJSON.close()