class _Config_Loader: """ Loads the Config file given while instantiating """ def __init__(self, config_path): from utility.exceptions import ImproperlyConfigured from pathlib import Path import yaml __config_path = Path(config_path).resolve() print('Loading Config from file %s' % __config_path) try: with open(__config_path, 'r') as yaml_config_file: self.config = yaml.safe_load(yaml_config_file) except (yaml.YAMLError, yaml.MarkedYAMLError) as e: raise ImproperlyConfigured( "Your settings file(s) contain invalid YAML syntax! Please fix and restart!\n" + repr(e)) config = _Config_Loader('config.yaml').config