Created
October 18, 2018 17:48
-
-
Save nandyne/5ff11254d8f28d4e06c09ea60235d7e8 to your computer and use it in GitHub Desktop.
Revisions
-
nandyne created this gist
Oct 18, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ 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