from __future__ import absolute_import
from __future__ import print_function
from runtime.Worker import worker
_PLCObjectSingleton = None
def GetPLCObjectSingleton():
assert _PLCObjectSingleton is not None
return _PLCObjectSingleton
def LogMessageAndException(msg, exp=None):
if _PLCObjectSingleton is not None:
_PLCObjectSingleton.LogMessage(0, msg + '\n'.join(traceback.format_exception(*exp)))
traceback.print_exception(*exp)
def CreatePLCObjectSingleton(*args, **kwargs):
global _PLCObjectSingleton
from runtime.PLCObject import PLCObject # noqa # pylint: disable=wrong-import-position
_PLCObjectSingleton = PLCObject(*args, **kwargs)
def default_evaluator(tocall, *args, **kwargs):
res = (tocall(*args, **kwargs), None)
res = (None, sys.exc_info())