Merged
authorLaurent Bessard
Thu, 18 Apr 2013 10:21:29 +0200
changeset 1037 978b14147e21
parent 1035 0f905e027d18 (diff)
parent 1036 a6718197caf2 (current diff)
child 1038 1923a69482f8
Merged
--- a/connectors/PYRO/__init__.py	Thu Apr 18 10:19:21 2013 +0200
+++ b/connectors/PYRO/__init__.py	Thu Apr 18 10:21:29 2013 +0200
@@ -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	Thu Apr 18 10:19:21 2013 +0200
+++ b/runtime/PLCObject.py	Thu Apr 18 10:21:29 2013 +0200
@@ -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()