runtime/PLCObject.py
branchwxPython4
changeset 3580 0c96269bf63b
parent 3578 d74eb1be6abe
child 3642 cd3d15e8ef42
child 3861 7e17f7e02a2b
--- a/runtime/PLCObject.py	Wed Aug 10 16:44:58 2022 +0200
+++ b/runtime/PLCObject.py	Thu Aug 11 17:39:12 2022 +0200
@@ -466,7 +466,7 @@
                 self.PythonThreadAcknowledge(cmd)
                 self.PythonRuntimeCall("start")
                 self.LogMessage("Python extensions started")
-                self.PostStartPLC()
+                self._PostStartPLC()
                 self.PythonThreadLoop()
                 self.PythonRuntimeCall("stop", reverse_order=True)
             elif cmd == "Finish":
@@ -504,6 +504,13 @@
         """
         pass
 
+    def _PostStartPLC(self):
+        try:
+            self.PostStartPLC()
+        except Exception:
+            self.LogMessage(0, 'Post Start Exception'+'\n'.join(
+                traceback.format_exception(*sys.exc_info())))
+
     def PostStartPLC(self):
         """ 
         Here goes actions to be taken after PLC is started, 
@@ -730,7 +737,7 @@
                 return self.DebugToken
         else:
             self._suspendDebug(True)
-        return None
+        return 4 # DEBUG_SUSPENDED
 
     def _TracesSwap(self):
         self.LastSwapTrace = time()