]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blobdiff - helpers/mapping.py
Print error when loading yaml
[perso/Immae/Projets/Python/MusicSampler.git] / 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']