diff options
Diffstat (limited to 'lorrycontroller/readconf.py')
-rw-r--r-- | lorrycontroller/readconf.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index aee2462..162e116 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -23,6 +23,7 @@ import re import bottle import cliapp +import yaml import lorrycontroller @@ -238,9 +239,12 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): try: with open(filename) as f: - obj = json.load(f) + try: + obj = yaml.safe_load(f) + except yaml.YAMLError: + obj = json.load(f) except ValueError as e: - logging.error('JSON problem in %s', filename) + logging.error('YAML and JSON problem in %s', filename) return [] if type(obj) != dict: |