Help with Exception, org.python.core.PyException: SystemExit: 0

In our Validation system we have seen the below error a few times, though is seems to be intermittent, and I’d like to get some help deciphering this if possible.
This is being generated by a script on a button in an embedded view. The button script calls a project script library function the essentially triggers a micrometer to carry out measurement tasks. Though we get this error, it seems like the part measurement carries on as expected. The micrometer is setup as a TCP Driver Device and is one of four different micrometers. We have only seen this error for the #2 micrometer, but we have only recently put any of the others to use.
We are using v8.1.10 of Ignition.
Any information as to the meaning of the error content would be helpful as I am at a bit of a loss as to how to track down the root cause of this error.

com.inductiveautomation.ignition.common.script.JythonExecException: SystemExit: 0
at org.python.core.PySystemState.exit(
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.__call__(
at org.python.core.PyReflectedFunction.__call__(
at org.python.core.PyObject.__call__(
at org.python.core.PyObject.__call__(
at org.python.core.PyMethod.__call__(
at org.python.pycode._pyx15159.switchMicrometerProgram$8(:524)
at org.python.pycode._pyx15159.call_function()
at org.python.core.PyFunction.__call__(
at org.python.pycode._pyx15798.runAction$1(:22)
at org.python.pycode._pyx15798.call_function()
at org.python.core.PyFunction.function___call__(
at org.python.core.PyFunction.__call__(
at org.python.core.PyFunction.__call__(
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(
at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(
at com.inductiveautomation.perspective.gateway.action.ActionDecorator.runAction(
at com.inductiveautomation.perspective.gateway.action.SecuredAction.runAction(
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(
at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$
at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$
at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$
at java.base/java.util.concurrent.Executors$ Source)
at java.base/ Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$ Source)
at java.base/ Source)
Caused by: org.python.core.PyException: SystemExit: 0
... 41 common frames omitted

Looks to me like you’re calling exit() from a Perspective script action?

Looks like you hit the nail on the head!
I’m not terribly familiar with this code as another developer wrote it.
There is a try/except block in the switchMicrometerProgram() function. The last line of the except section contains the line:


Looking at the Python doc for this function, it seems this “exits from Python” and raises the exception.
I’m not an application developer, just an old electrical engineer pretending to be a software guy!
It doesn’t seem like this is hurting anything, but, is this the proper way to raise an exception in a script in Ignition?

Usually when I see someone trying to exit() it’s because they’re being lazy about control flow or can’t figure out another way to return early from the function they’re writing.

There’s probably a better way.

Thanks Kevin,
I’ll look into a change for this when time allows.
For now, unless it starts causing issues, we’ll leave it as is and I’ll also talk with the my fellow developer to see if he wants to revisit it as well.

If the function doesn’t return anything then you can simply replace it with return.

1 Like