From d9eb9efaf85a3e6c7d2ef62a0c08acfa5b9a59a5 Mon Sep 17 00:00:00 2001 From: sezanzeb Date: Mon, 15 Feb 2021 18:27:34 +0100 Subject: [PATCH] falling back to defaults for broken configs --- keymapper/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keymapper/config.py b/keymapper/config.py index 30a68a77..7af9cadd 100644 --- a/keymapper/config.py +++ b/keymapper/config.py @@ -248,10 +248,11 @@ class GlobalConfig(ConfigBase): logger.info('Loaded config from "%s"', self.path) except json.decoder.JSONDecodeError as error: logger.error( - 'Failed to parse config "%s": %s', + 'Failed to parse config "%s": %s. Using defaults', self.path, str(error) ) - sys.exit(1) + # uses the default configuration when the config object + # is empty automatically def save_config(self): """Save the config to the file system.""" @@ -264,7 +265,6 @@ class GlobalConfig(ConfigBase): with open(self.path, 'w') as file: json.dump(self._config, file, indent=4) logger.info('Saved config to %s', self.path) - shutil.chown(self.path, USER, USER) file.write('\n')