Hi have a Message Handler on the root of a Perspective view.
In the script I am assigning a varialbe to the value contained in a root.custom.property.
When this script runs I get the following error:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 11, in onMessageReceived AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'workOrderQuantity'
at org.python.core.Py.AttributeError(Py.java:207)
at org.python.core.PyObject.noAttributeError(PyObject.java:1032)
at org.python.core.PyObject.__getattr__(PyObject.java:1027)
at org.python.pycode._pyx187.onMessageReceived$1(:12)
at org.python.pycode._pyx187.call_function()
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyBaseCode.call(PyBaseCode.java:308)
at org.python.core.PyFunction.function___call__(PyFunction.java:471)
at org.python.core.PyFunction.__call__(PyFunction.java:466)
at org.python.core.PyFunction.__call__(PyFunction.java:461)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:822)
at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:806)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:687)
at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:965)
at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:752)
at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:101)
at com.inductiveautomation.perspective.gateway.model.MessageHandlerCollection$MessageHandlerImpl$1.lambda$invoke$0(MessageHandlerCollection.java:80)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 11, in onMessageReceived AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'workOrderQuantity'
The Custom Property is shown in the screen grab below:
The script is as follows:
self.refreshBinding("custom.dsWOTotals")
self.refreshBinding("custom.workOrderOpSubmitted")
self.refreshBinding("custom.qtyCompleted")
self.refreshBinding("custom.qtyRejected")
self.refreshBinding("custom.workOrderStatus")
self.refreshBinding("custom.workOrderQuantity")
self.refreshBinding("custom.workOrderPartNumber")
self.refreshBinding("custom.enabelWorkOrderEdit")
qty = self.custom.workOrderQuantity
self.view.params.qtyOrdered = qty
Note: I set the qty variable = to the custom property to isolate it from the line setting the view’s parameter.
As I used the Property Browser in the script editor for the message handler, I know the spelling and path to the property are both correct.
Any ideas why I’m getting this error?
The error also generates after I’ve saved the view, closed the project, and re-open the project and view (the message handler is called by an onStartup script in the view to refresh the data bindings in the view).
Thanks.