From 34a3af7ca335588132d8ec0f7b79b8c0b9150ebb Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 12 Apr 2016 19:56:47 +0200 Subject: [PATCH] don't display an error if the config file does not exist. assume it is JSON --- lib/simple_config.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/simple_config.py b/lib/simple_config.py index 6f472168..52568a57 100644 --- a/lib/simple_config.py +++ b/lib/simple_config.py @@ -211,20 +211,15 @@ def read_user_config(path): if not path: return {} config_path = os.path.join(path, "config") + if not os.path.exists(config_path): + return {} try: with open(config_path, "r") as f: data = f.read() - except IOError: - print_msg("Error: Cannot read config file.", path) - return {} - try: result = json.loads(data) except: - try: - result = ast.literal_eval(data) - except: - print_msg("Error: Cannot read config file.") - return {} + print_msg("Warning: Cannot read config file.", config_path) + return {} if not type(result) is dict: return {} return result