From a72ccd4b2699effcc2f6bd1d06abee729e770729 Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Fri, 13 Oct 2023 13:53:54 +0200 Subject: [PATCH] Better error message --- dyn_gandi/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dyn_gandi/main.py b/dyn_gandi/main.py index b7a0d68..85472d5 100644 --- a/dyn_gandi/main.py +++ b/dyn_gandi/main.py @@ -13,7 +13,7 @@ def loadSettings(path: str | None) -> dict: Load the settings file. `path` Path to a settings file. - By default the program will look for `$HOME/dyn-gandi/config.json` and then `/etc/dyn-gandi.json`. + By default the program will look for `$HOME/.config/dyn-gandi/config.json` and then `/etc/dyn-gandi.json`. ''' if path is None: @@ -22,6 +22,11 @@ def loadSettings(path: str | None) -> dict: if not os.path.exists(path): path = '/etc/dyn-gandi.json' + if not os.path.exists(path): + print( + f"[ERROR] No config file found at '~/.config/dyn-gandi/config.json' or '/etc/dyn-gandi.json'") + quit() + if not os.path.exists(path): print(f"[ERROR] '{path}' does not exist.") quit()