From: Ismaƫl Bouya Date: Mon, 18 Jul 2016 18:11:54 +0000 (+0200) Subject: Print error when loading yaml X-Git-Tag: 1.0.0~43 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=6c44b2313c8c115ee05ffe9106ccd8517ec5c66b;p=perso%2FImmae%2FProjets%2FPython%2FMusicSampler.git Print error when loading yaml --- 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']