Error executing script for event: propertyChange on component: Image 2

I'm getting this error when opening a window. I've inspceted "Image 2" and there isnt any properties associated with it that i can find. its just an image of piping.
Below are the error details. Any help on resolving this is greatly appreciated!

Traceback (most recent call last):
File "event:propertyChange", line 2, in
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

at org.python.core.Py.TypeError(Py.java:234)
at org.python.core.PyObject._basic_div(PyObject.java:2421)
at org.python.core.PyObject._div(PyObject.java:2398)
at org.python.pycode._pyx243.f$0(<event:propertyChange>:2)
at org.python.pycode._pyx243.call_function(<event:propertyChange>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1703)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:804)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:207)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter$ActionRunner.run(ActionAdapter.java:315)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Ignition v8.1.35 (b2023120517)
Java: Azul Systems, Inc. 17.0.8

Show the code in the propertyChange event.

There is a property change event script in which you are trying to divide two values, one of those values is None. I suspect that this is probably a reference to a property which on startup doesn't have a value.

I would check the Window related event handlers

The topic title clearly identifies the specific component that has the problem script. The following details clearly identify exactly which script is the problem and the line number with the offending operation.

"if event.propertyName == 'Out':
system.gui.transform(event.source,3,0,12, event.source.Out / 100 * 110)"

When the window is opened the Out custom property is None. You need to block against this in your code.

if event.propertyName == 'Out' and event.source.Out:
    system.gui.transform(event.source, 3, 0, 12, event.source.Out / 100 * 110)

The property will then update again with the "default" value for the property.

1 Like

In a propertyChange event, event.newValue can also be used, and if the 'Falsy' value of 0 could be an acceptable value for the Out property, the if statement will need to be explicit to filter out only null values:

if event.propertyName == 'Out' and event.newValue is not None:
	system.gui.transform(event.source, 3, 0, 12, event.newValue / 100 * 110)