diff options
| author | Jacob McDonnell <jacob@simplelittledream.com> | 2022-10-31 15:17:09 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@simplelittledream.com> | 2022-10-31 15:17:09 -0400 |
| commit | b2e6cdde266260a525ef80147dacbcd2ada3a985 (patch) | |
| tree | c1c40d6fbba8d53889040bffb22e46c58b51b4c5 /settings.py | |
| parent | 4681ebe60b5020c63c58034ad3072c0c5e3ca940 (diff) | |
Better organization of codeporting-to-pico
Diffstat (limited to 'settings.py')
| -rw-r--r-- | settings.py | 18 |
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() |
