]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Print error when loading yaml
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 18 Jul 2016 18:11:54 +0000 (20:11 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 18 Jul 2016 18:11:54 +0000 (20:11 +0200)
helpers/mapping.py

index 858fe77354fa483b857f77428d2735d501e67d42..19fc3c5f2140ec9ba64feac2984b97d720e9f05b 100644 (file)
@@ -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']