diff --git a/src/linkahead/configuration.py b/src/linkahead/configuration.py index c65d63d4f155f4f86831e41a0e2105d16e2e7809..e47af23c013ea3ed78d55ee825c1bc651cfbca10 100644 --- a/src/linkahead/configuration.py +++ b/src/linkahead/configuration.py @@ -111,25 +111,24 @@ def _read_config_files(): """ return_var = [] + ini_user = expanduser('~/.pylinkahead.ini') + ini_cwd = join(getcwd(), "pylinkahead.ini") if "PYCAOSDBINI" in environ: raise RuntimeError("You have set the old PYCAOSDBINI environment variable. Please use the " "new PYLINKAHEADINI variable instead and unset the old one.") - if os.path.exists(expanduser('~/.pycaosdb.ini')): + if os.path.exists(ini_user): raise RuntimeError("You have a config file with the old naming scheme (pycaosdb.ini). " f"Please use the new version and rename\n" - f"{expanduser('~/.pycaosdb.ini')}\n" - f"to\n{expanduser('~/.pylinkahead.ini')}") - if os.path.exists(join(getcwd(), "pycaosdb.ini")): + f" {ini_user}\nto\n {expanduser('~/.pylinkahead.ini')}") + if os.path.exists(ini_cwd): raise RuntimeError("You have a config file with the old naming scheme (pycaosdb.ini). " f"Please use the new version and rename\n" - f"{join(getcwd(), 'pycaosdb.ini')}\n" - f"to\n{join(getcwd(), 'pylinkahead.ini')}") + f" {ini_cwd}\nto\n {join(getcwd(), 'pylinkahead.ini')}") if "PYLINKAHEADINI" in environ: return_var.extend(configure(expanduser(environ["PYLINKAHEADINI"]))) else: - return_var.extend(configure(expanduser('~/.pylinkahead.ini'))) - - if isfile(join(getcwd(), "pylinkahead.ini")): - return_var.extend(configure(join(getcwd(), "pylinkahead.ini"))) + return_var.extend(configure(ini_user)) + if isfile(ini_cwd): + return_var.extend(configure(ini_cwd)) return return_var