From 6c44b2313c8c115ee05ffe9106ccd8517ec5c66b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 18 Jul 2016 20:11:54 +0200 Subject: [PATCH] Print error when loading yaml --- helpers/mapping.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helpers/mapping.py b/helpers/mapping.py index 858fe77..19fc3c5 100644 --- a/helpers/mapping.py +++ b/helpers/mapping.py @@ -9,7 +9,7 @@ import sys from .music_file import * from .mixer import Mixer -from . import Config, gain +from . import Config, gain, error_print class Mapping(RelativeLayout): expected_keys = NumericProperty(0) @@ -89,7 +89,11 @@ class Mapping(RelativeLayout): def parse_config(self): stream = open(Config.yml_file, "r") - config = yaml.load(stream) + try: + config = yaml.load(stream) + except yaml.scanner.ScannerError as e: + error_print("Error while loading config file: {}".format(e)) + sys.exit() stream.close() aliases = config['aliases'] -- 2.41.0