From 77c11ae8559562ad95d7d99c961cf1c10793ab19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Barto=C5=A1?= <bartos@cesnet.cz> Date: Wed, 11 Apr 2018 16:05:37 +0200 Subject: [PATCH] client: read_cfg handling of relative paths changed read_cfg() no longer add directory of warden_client.py in front of the config file name. It simply opens the path/filename passed. This allows to install warden_client.py to system paths and use relative paths to config files, but IT MAY BROKE SOME EXISTING INSTALLATIONS if they use relative path to config file and run script from different directory than where warden_client.py is located. --- warden3/warden_client/warden_client.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/warden3/warden_client/warden_client.py b/warden3/warden_client/warden_client.py index 3604e56..cdcec00 100644 --- a/warden3/warden_client/warden_client.py +++ b/warden3/warden_client/warden_client.py @@ -662,7 +662,6 @@ def format_time(year, month, day, hour, minute, second, microsec=0, utcoffset=No def read_cfg(cfgfile): - abspath = path.join(path.dirname(__file__), cfgfile) - with open(abspath, "r") as f: + with open(cfgfile, "r") as f: stripcomments = "\n".join((l for l in f if not l.lstrip().startswith(("#", "//")))) return json.loads(stripcomments) -- GitLab