summaryrefslogtreecommitdiff
path: root/gerber
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-07-25 09:48:58 -0400
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-07-25 09:48:58 -0400
commitd4a870570855265b9b37f1609dd2bc9f49699bb6 (patch)
tree8b59807651b79820b5980451c6496bb9d6bb9851 /gerber
parent39726e3936c5fa5c50158727e8eb7f5d01cb1b49 (diff)
downloadgerbonara-d4a870570855265b9b37f1609dd2bc9f49699bb6.tar.gz
gerbonara-d4a870570855265b9b37f1609dd2bc9f49699bb6.tar.bz2
gerbonara-d4a870570855265b9b37f1609dd2bc9f49699bb6.zip
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.
Diffstat (limited to 'gerber')
-rw-r--r--gerber/render/cairo_backend.py4
1 files changed, 3 insertions, 1 deletions
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)