From e2d92b5575737f606f6eb0a36856e970246e294d Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Tue, 15 Feb 2022 11:42:50 -0500 Subject: [PATCH] confighelper: use read_file() rather than read() The read() method will return an empty list if the file specified does not exist or if the read failed in some fashion. Signed-off-by: Eric Callahan --- moonraker/confighelper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moonraker/confighelper.py b/moonraker/confighelper.py index b0bc3fb..07b0d87 100644 --- a/moonraker/confighelper.py +++ b/moonraker/confighelper.py @@ -378,7 +378,7 @@ class ConfigHelper: f"Configuration File Not Found: '{cfg_file_path}''") try: sup_cfg = configparser.ConfigParser(interpolation=None) - sup_cfg.read(cfg_file_path) + sup_cfg.read_file(open(cfg_file_path)) except Exception: raise ConfigError(f"Error Reading Config: '{cfg_file_path}'") sections = sup_cfg.sections() @@ -416,7 +416,7 @@ def get_configuration(server: Server, app_args['config_file'])) config = configparser.ConfigParser(interpolation=None) try: - config.read(cfg_file_path) + config.read_file(open(cfg_file_path)) except Exception as e: if not os.path.isfile(cfg_file_path): raise ConfigError(