Better mdns resolution failure signaling, added fixed bug whith runtime autostart
authorEdouard Tisserant
Wed, 17 Apr 2013 10:54:17 +0900
changeset 1035 0f905e027d18
parent 1034 078bf153fb8c
child 1037 978b14147e21
Better mdns resolution failure signaling, added fixed bug whith runtime autostart
connectors/PYRO/__init__.py
runtime/PLCObject.py
--- a/connectors/PYRO/__init__.py	Mon Apr 15 00:36:41 2013 +0200
+++ b/connectors/PYRO/__init__.py	Wed Apr 17 10:54:17 2013 +0900
@@ -45,6 +45,7 @@
             from util.Zeroconf import Zeroconf
             r = Zeroconf()
             i=r.getServiceInfo(service_type, location)
+            if i is None : raise Exception, "'%s' not found"%location
             ip = str(socket.inet_ntoa(i.getAddress()))
             port = str(i.getPort())
             newlocation = ip+':'+port
--- a/runtime/PLCObject.py	Mon Apr 15 00:36:41 2013 +0200
+++ b/runtime/PLCObject.py	Wed Apr 17 10:54:17 2013 +0900
@@ -196,6 +196,9 @@
             self._GetLogMessage.argtypes = [ctypes.c_uint8, ctypes.c_uint32, ctypes.c_char_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
 
             self._loading_error = None
+
+            self.PythonRuntimeInit()
+
             return True
         except:
             self._loading_error = traceback.format_exc()
@@ -402,11 +405,8 @@
 
             if self.LoadPLC():
                 self.PLCStatus = "Stopped"
-                try:
-                    self.PythonRuntimeInit()
-                except:
-                    self.PLCStatus = "Broken"
             else:
+                self.PLCStatus = "Broken"
                 self._FreePLC()
             self.StatusChange()