--- a/Beremiz_service.py Mon Aug 14 22:30:41 2017 +0300
+++ b/Beremiz_service.py Mon Aug 14 23:27:15 2017 +0300
@@ -28,6 +28,7 @@
import getopt
from threading import Thread
+
def usage():
print """
Usage of Beremiz PLC execution service :\n
@@ -116,9 +117,11 @@
if __name__ == '__main__':
__builtin__.__dict__['_'] = lambda x: x
+
def Bpath(*args):
return os.path.join(beremiz_dir,*args)
+
def SetupI18n():
# Import module for internationalization
import gettext
@@ -379,6 +382,7 @@
if not os.path.isdir(WorkingDir):
os.mkdir(WorkingDir)
+
def default_evaluator(tocall, *args, **kwargs):
try:
res=(tocall(*args,**kwargs), None)
@@ -386,6 +390,7 @@
res=(None, sys.exc_info())
return res
+
class Server():
def __init__(self, servicename, ip_addr, port,
workdir, argv, autostart=False,
@@ -528,6 +533,8 @@
# Exception hooks s
import threading
import traceback
+
+
def LogException(*exp):
if pyroserver.plcobj is not None:
pyroserver.plcobj.LogMessage(0,'\n'.join(traceback.format_exception(*exp)))
@@ -535,6 +542,8 @@
traceback.print_exception(*exp)
sys.excepthook = LogException
+
+
def installThreadExcepthook():
init_old = threading.Thread.__init__
def init(self, *args, **kwargs):