From 2f0a955a07c5951bb0f2229d8aa38468a9d09fad Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sun, 23 Oct 2022 12:13:33 +0200 Subject: [PATCH] Added config file not found exception --- modules/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/utils.py b/modules/utils.py index b43c5ff..6a761e0 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -68,7 +68,11 @@ def configGet(key: str, *args: str, file: str = "config"): * any: Value of provided key """ if file == "config": - this_dict = jsonLoad("config.json") + try: + this_dict = jsonLoad("config.json") + except FileNotFoundError: + print("Config file not found! Copy config_example.json to config.json, configure it and rerun the bot!") + exit() else: this_dict = jsonLoad(f"data{sep}users{sep}{file}.json") this_key = this_dict