From 1d4127925dfe9c43281b99a43a9ef4dcf7351dc8 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 10 Feb 2019 08:07:06 +0200 Subject: export: Print error message if template can't be parsed. --- pywal/export.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pywal') diff --git a/pywal/export.py b/pywal/export.py index 83dd15c..fb284bd 100644 --- a/pywal/export.py +++ b/pywal/export.py @@ -12,7 +12,13 @@ def template(colors, input_file, output_file=None): """Read template file, substitute markers and save the file elsewhere.""" template_data = util.read_file_raw(input_file) - template_data = "".join(template_data).format(**colors) + + try: + template_data = "".join(template_data).format(**colors) + except ValueError: + logging.error("Syntax error in template file '%s'. " + "Are non-marker braces escaped? '{{}}'?" % input_file) + return util.save_file(template_data, output_file) -- cgit v1.2.3