From 094aebf62c1f643dbe6518f1d44ddfe0a0c2bcc9 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Sat, 2 Dec 2023 16:47:13 -0800 Subject: [PATCH] If WEEWX_ROOT=='/', set it to '/etc/weewx' --- src/weecfg/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/weecfg/__init__.py b/src/weecfg/__init__.py index d155d7f0..dcd4c7ca 100644 --- a/src/weecfg/__init__.py +++ b/src/weecfg/__init__.py @@ -166,6 +166,8 @@ def read_config(config_path, args=None, locations=DEFAULT_LOCATIONS, if 'WEEWX_ROOT' not in config_dict: # If missing, set WEEWX_ROOT to the directory the config file is in config_dict['WEEWX_ROOT'] = os.path.dirname(config_path) + elif config_dict['WEEWX_ROOT'] == '/': + config_dict['WEEWX_ROOT'] == '/etc/weewx' # In case WEEWX_ROOT is a relative path, join it with the location of the config file, then # convert it to an absolute path. config_dict['WEEWX_ROOT'] = os.path.abspath(os.path.join(os.path.dirname(config_path),