From 9f86ea1f30f3125b1126bbd25a9f908cefd4f96c Mon Sep 17 00:00:00 2001 From: Scott Wallace <scott@wallace.sh> Date: Thu, 27 May 2021 08:04:55 +0100 Subject: [PATCH] Add a conditional around the config file parsing attempt --- src/Alertify/config.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Alertify/config.py b/src/Alertify/config.py index 8af303b..b9f504f 100644 --- a/src/Alertify/config.py +++ b/src/Alertify/config.py @@ -30,13 +30,14 @@ class Config: logging.debug('Parsing config') parsed = {} - try: - with open(configfile, 'r') as file: - parsed = yaml.safe_load(file.read()) - except FileNotFoundError as error: - logging.warning('No config file found (%s)', error.filename) - except TypeError: - logging.warning('No config file provided.') + if configfile is not None: + try: + with open(configfile, 'r') as file: + parsed = yaml.safe_load(file.read()) + except FileNotFoundError as error: + logging.warning('No config file found (%s)', error.filename) + except TypeError: + logging.warning('No config file provided.') # Iterate over the config defaults and check for environment variable # overrides, then check for any items in the config, otherwise