Skip to content

Commit

Permalink
prevent exception in CLI scripts if no config file was specified and …
Browse files Browse the repository at this point in the history
…none was found in the hard-coded locations
  • Loading branch information
FelixSchwarz committed Aug 5, 2024
1 parent ec64717 commit 31bd15c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions schwarz/mailqueue/app_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 31bd15c

Please sign in to comment.