diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2019-02-10 08:07:06 +0200 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2019-02-10 08:07:06 +0200 |
| commit | 1d4127925dfe9c43281b99a43a9ef4dcf7351dc8 (patch) | |
| tree | c82592388e0e213e664dfd216408639ea5b75702 | |
| parent | 668f9bbd5bffc6b7d65254da9a6bf6581a6726e9 (diff) | |
export: Print error message if template can't be parsed.
| -rw-r--r-- | pywal/export.py | 8 |
1 files changed, 7 insertions, 1 deletions
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) |
