Close gcode file explicitly after reading

master
Kliment 2011-08-11 15:02:41 +02:00
parent df051e600f
commit dbf3e7f0a2
1 changed files with 6 additions and 2 deletions

View File

@ -942,7 +942,9 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
fn=self.filename
try:
self.filename=self.filename.replace(".stl","_export.gcode").replace(".STL","_export.gcode")
self.f=[i.replace("\n","").replace("\r","") for i in open(self.filename)]
of=open(self.filename)
self.f=[i.replace("\n","").replace("\r","") for i in of]
of.close
if self.p.online:
wx.CallAfter(self.printbtn.Enable)
@ -992,8 +994,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
if name.lower().endswith(".stl"):
self.skein(name)
else:
self.f=[i.replace("\n","").replace("\r","") for i in open(name)]
self.filename=name
of=open(self.filename)
self.f=[i.replace("\n","").replace("\r","") for i in of]
of.close
self.status.SetStatusText("Loaded "+name+", %d lines"%(len(self.f),))
wx.CallAfter(self.printbtn.SetLabel, "Print")
wx.CallAfter(self.pausebtn.SetLabel, "Pause")