plint

French poetry validator
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

commit 7428a885e60723b702906db54d2961a3261693a0
parent 903f0ea75d9dd9386c25bbc831b1c766d731c81c
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed, 30 Jan 2013 23:13:28 +0100

Report template errors with plint.py

Diffstat:
plint.py | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/plint.py b/plint.py @@ -3,6 +3,7 @@ import localization import sys import template +import error def run(): ok = True @@ -31,11 +32,16 @@ if __name__ == '__main__': file=sys.stderr) sys.exit(1) - f = open(sys.argv[1]) + template_name = sys.argv[1] + f = open(template_name) x = f.read() f.close() - template = template.Template(x) + try: + template = template.Template(x) + except error.TemplateLoadError as e: + print("Could not load template %s: %s" % (template_name, e.msg), file=sys.stderr) + sys.exit(2) ok = run() sys.exit(0 if ok else 1)