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.
This commit is contained in:
Hamilton Kibbe 2015-07-25 09:48:58 -04:00
parent 39726e3936
commit d4a8705708

View file

@ -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)