From 469faef41de6d638d82bc9f693a7e6b260c468d1 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 17 Mar 2014 20:41:25 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20d'un=20bug=20:=20ne=20plante=20pas?= =?UTF-8?q?=20si=20le=20fichier=20tex=20ne=20contient=20aucune=20ligne=20d?= =?UTF-8?q?=C3=A9finissant=20des=20valeurs=20du=20template,=20commen=C3=A7?= =?UTF-8?q?ant=20par=20%%=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- songbook_core/build.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/songbook_core/build.py b/songbook_core/build.py index e16703af..68ecb596 100755 --- a/songbook_core/build.py +++ b/songbook_core/build.py @@ -37,13 +37,14 @@ def parse_template(template): if embedded_json_pattern.match(line) ] - data = json.loads(''.join(code)) parameters = dict() - for param in data: - try: - parameters[param["name"]] = param["default"] - except KeyError: - parameters[param["name"]] = None + if code: + data = json.loads(''.join(code)) + for param in data: + try: + parameters[param["name"]] = param["default"] + except KeyError: + parameters[param["name"]] = None return parameters