Fix error about missing attribute 'timeout' that happens sometimes during compilation
The fix [1476:49f1763a5613] of the problem with following trace was wrong.
Traceback (most recent call last):
File "./Beremiz.py", line 1229, in run_with_except_hook
run_old(*args, **kw)
File
"/home/developer/WorkData/PLC/beremiz/beremiz/util/ProcessLogger.py",
line 68, in run
self.endcallback(self.Proc.pid, err)
File
"/home/developer/WorkData/PLC/beremiz/beremiz/util/ProcessLogger.py",
line 169, in finish
if self.timeout: self.timeout.cancel()
AttributeError: ProcessLogger instance has no attribute 'timeout'
The problem was that compilation process was finished before the timeout attribute is set.
Now timeout is set before launcing of compilation process.
--- a/util/ProcessLogger.py Wed Apr 27 18:42:30 2016 +0300
+++ b/util/ProcessLogger.py Thu Apr 28 12:58:58 2016 +0300
@@ -124,6 +124,12 @@
elif wx.Platform == '__WXGTK__':
popenargs["shell"] = False
+ if timeout:
+ self.timeout = Timer(timeout,self.endlog)
+ self.timeout.start()
+ else:
+ self.timeout = None
+
self.Proc = subprocess.Popen( self.Command, **popenargs )
self.outt = outputThread(
@@ -139,11 +145,6 @@
self.errors)
self.errt.start()
- if timeout:
- self.timeout = Timer(timeout,self.endlog)
- self.timeout.start()
- else:
- self.timeout = None
def output(self,v):
self.outdata.append(v)