diff --git a/src/config.py b/src/config.py index 8632ba1..15c5c70 100644 --- a/src/config.py +++ b/src/config.py @@ -2,15 +2,19 @@ import configparser import getpass import os from pathlib import Path + home = str(Path.home()) config = configparser.ConfigParser() # check the config file existence config_file_path = home + "/config.ini" -config.read(config_file_path) -CONTACT_LIST_FILE = config['DEFAULT']['contact_list_file'] -FIREBASE_CONFIG_FILE = config['DEFAULT']['firebase_config_file'] -LOGS_DIR = config['DEFAULT']['LOGS_DIR'] +if Path(config_file_path).is_file(): + config.read(config_file_path) + CONTACT_LIST_FILE = config['DEFAULT']['contact_list_file'] + FIREBASE_CONFIG_FILE = config['DEFAULT']['firebase_config_file'] + LOGS_DIR = config['DEFAULT']['LOGS_DIR'] +else: + print("config file not found") username = getpass.getuser() LOG_SOURCE = username -ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) \ No newline at end of file +ROOT_DIR = os.path.dirname(os.path.abspath(__file__))