From 61aa8711e1079f2a6b886f1b1e36dbf795c3f834 Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Fri, 26 Jun 2020 00:59:54 +0200 Subject: [PATCH] Bugfix read and image location in config --- km3buu/config.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/km3buu/config.py b/km3buu/config.py index 1991b15..7b554f0 100644 --- a/km3buu/config.py +++ b/km3buu/config.py @@ -31,7 +31,10 @@ class Config(object): def __init__(self, config_path=CONFIG_PATH): self.config = ConfigParser() self._config_path = config_path - os.makedirs(dirname(CONFIG_PATH), exist_ok=True) + if isfile(self._config_path): + self.config.read(self._config_path) + else: + os.makedirs(dirname(CONFIG_PATH), exist_ok=True) def set(self, section, key, value): if section not in self.config.sections(): @@ -54,7 +57,7 @@ class Config(object): def gibuu_image_path(self): section = "GiBUU" key = "image_path" - image_path = self.get(section, section) + image_path = self.get(section, key) if image_path is None or not isfile(image_path): dev_path = abspath(join(dirname(__file__), os.pardir, IMAGE_NAME)) if isfile(dev_path): -- GitLab