From e5907ad380e46fad5a2394fdbefe635ac94e0177 Mon Sep 17 00:00:00 2001 From: Niels Giorno Date: Fri, 28 Aug 2020 12:53:46 +0200 Subject: [PATCH] Fix jinja2 dump in temporary file for Windows tempfile.NamedTemporaryFile() creates **and opens** the file. jinja2.stream().dump() will try to open the file too, if given a str (filename). This does not cause issue on Linux, but on Windows the same file cannot be open twice at the same time... The solution was to pass a file pointer to 'dump()' instead of the filename, so jinja2 does not need to open it again. --- lokrez/export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lokrez/export.py b/lokrez/export.py index f7c2cab..0dec772 100644 --- a/lokrez/export.py +++ b/lokrez/export.py @@ -63,7 +63,7 @@ def generate_outfile( ) import subprocess - jj2_tpl.stream(context).dump( tmpsvg.name ) + jj2_tpl.stream(context).dump( tmpsvg ) inkscape_process = subprocess.Popen( [