Created
September 19, 2019 18:16
-
-
Save JoaoCarabetta/061865466594f13154559dda0f009d5a to your computer and use it in GitHub Desktop.
Load config from yaml
This file contains 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 characters
def open_yaml(path): | |
""" | |
Load yaml file. | |
Parameters | |
---------- | |
path: pathlib.PosixPath | |
Path to yaml file | |
Return | |
------ | |
Dictionary | |
Dictionary with yaml file content | |
""" | |
with open(path) as stream: | |
try: | |
yaml_dict = yaml.safe_load(stream) | |
except yaml.YAMLError as exc: | |
logging.error('Error when opening YAML file.', exc_info=1) | |
return yaml_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment