From d4a870570855265b9b37f1609dd2bc9f49699bb6 Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Sat, 25 Jul 2015 09:48:58 -0400 Subject: Fix windows permission error per #33 the issue was trying to re-open the temporary file. it works on everything but windows. I've changed it to seek to the beginning and read from the file without re-opening, which should fix the issue. --- gerber/render/cairo_backend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gerber/render') diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py index 2791d76..0ae5d40 100644 --- a/gerber/render/cairo_backend.py +++ b/gerber/render/cairo_backend.py @@ -154,7 +154,9 @@ class GerberCairoContext(GerberContext): self.surface_buffer.flush() with open(filename, "w") as f: - f.write(open(self.surface_buffer.name, "r").read()) + self.surface_buffer.seek(0) + f.write(self.surface_buffer.read()) f.flush() + else: self.surface.write_to_png(filename) -- cgit