From b4db1782bea320160a498d83a5598a5c65b42657 Mon Sep 17 00:00:00 2001 From: Rich Bell Date: Tue, 12 Jan 2021 20:51:46 -0500 Subject: [PATCH] log configuration errors (#637) Looks good! Thanks, Rich. --- bin/weewxd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/weewxd b/bin/weewxd index 2588191f..c204d01b 100755 --- a/bin/weewxd +++ b/bin/weewxd @@ -17,6 +17,7 @@ import sys import time from optparse import OptionParser +import configobj import daemon import weecfg import weedb @@ -123,9 +124,11 @@ def main(): try: # Pass in a copy of the command line arguments. read_config() will change it. config_path, config_dict = weecfg.read_config(options.config_path, list(args)) - except IOError as e: + except (IOError, configobj.ConfigObjError) as e: + log.error("Error parsing config file: %s" % e) + weeutil.logger.log_traceback(log.critical, " **** ") print(e, file=sys.stderr) - sys.exit(weewx.CMD_ERROR) + sys.exit(weewx.CMD_ERROR) log.info("Using configuration file %s", config_path) weewx.debug = int(config_dict.get('debug', 0))