From 31bd15ceac6eb817fdd81d5915063c441704a738 Mon Sep 17 00:00:00 2001 From: Felix Schwarz Date: Mon, 5 Aug 2024 16:06:29 +0200 Subject: [PATCH] prevent exception in CLI scripts if no config file was specified and none was found in the hard-coded locations --- schwarz/mailqueue/app_helpers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/schwarz/mailqueue/app_helpers.py b/schwarz/mailqueue/app_helpers.py index c0a6d9a..e4ed142 100644 --- a/schwarz/mailqueue/app_helpers.py +++ b/schwarz/mailqueue/app_helpers.py @@ -91,6 +91,9 @@ def guess_config_path(cfg_path: str) -> Optional[Path]: def parse_config(config_path, section_name=None): + if not config_path: + sys.stderr.write('No config file found.\n') + sys.exit(20) filename = os.path.basename(config_path) if not os.path.exists(config_path): sys.stderr.write('config file "%s" not found.\n' % filename)