X-Git-Url: https://git.novaco.in/?p=electrum-nvc.git;a=blobdiff_plain;f=lib%2Fsimple_config.py;h=d4893b11ebba4c05e07b3cd24b5ec44d686ff5e8;hp=86df56606912e91aa203e15311aeec582ebbd1ee;hb=34f0a65c49492ed62f399fd74aa25a6a4edcfc33;hpb=ad3640d7a4bc4627694df3c277cd83972256c543 diff --git a/lib/simple_config.py b/lib/simple_config.py index 86df566..d4893b1 100644 --- a/lib/simple_config.py +++ b/lib/simple_config.py @@ -157,19 +157,22 @@ def read_system_config(path=SYSTEM_CONFIG_PATH): def read_user_config(path): """Parse and store the user config settings in electrum.conf into user_config[].""" - if not path: return + if not path: return {} # Return a dict, since we will call update() on it. config_path = os.path.join(path, "config") + result = {} if os.path.exists(config_path): try: + with open(config_path, "r") as f: data = f.read() - except IOError: - return - try: - d = ast.literal_eval( data ) #parse raw data from reading wallet file + result = ast.literal_eval( data ) #parse raw data from reading wallet file + except Exception: print_msg("Error: Cannot read config file.") - return + result = {} - return d + if not type(result) is dict: + return {} + + return result