X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=rainbowstream%2Fconfig.py;h=58f747de33cf8ab627f1227137cc9e30be5227bc;hb=104619ced1219d339ff4fcc8891cbceffbb60fba;hp=e468c9c1d5725625133355d1af816ce99e426838;hpb=a8e71259e8f1b8bee68a3f85211517de336008a1;p=rainbowstream.git diff --git a/rainbowstream/config.py b/rainbowstream/config.py index e468c9c..58f747d 100644 --- a/rainbowstream/config.py +++ b/rainbowstream/config.py @@ -109,7 +109,7 @@ def delete_config(key): Delete a config key """ path = os.path.expanduser("~") + os.sep + '.rainbow_config.json' - try: + try: data = load_config(path) except: raise Exception('Config file is messed up.') @@ -133,8 +133,9 @@ def reload_config(): """ Reload config """ - try: - rainbow_config = os.path.expanduser("~") + os.sep + '.rainbow_config.json' + try: + rainbow_config = os.path.expanduser("~") + \ + os.sep + '.rainbow_config.json' data = load_config(rainbow_config) for d in data: c[d] = data[d] @@ -147,8 +148,8 @@ def init_config(): Init configuration """ # Load the initial config - config = os.path.dirname( - __file__) + '/colorset/config' + config = os.path.dirname(__file__) + \ + '/colorset/config' try: data = load_config(config) for d in data: @@ -161,11 +162,11 @@ def init_config(): data = load_config(rainbow_config) for d in data: c[d] = data[d] - except ValueError as e: + except (IOError, ValueError) as e: c['USER_JSON_ERROR'] = str(e) # Load default theme - theme_file = os.path.dirname( - __file__) + '/colorset/' + c['THEME'] + '.json' + theme_file = os.path.dirname(__file__) + \ + '/colorset/' + c['THEME'] + '.json' try: data = load_config(theme_file) for d in data: