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

**URL:** <https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [April 5, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431 "2024-04-05T14:53:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Puente](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Joseph\_Puente](https://forum.inductiveautomation.com/u/Joseph_Puente)\
**Post date:** [April 5, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/1 "2024-04-05T14:53:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 5, 2024, 2:55pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/2 "2024-04-05T14:55:04Z")

</div>

Show the code in the propertyChange event.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 5, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/3 "2024-04-05T15:08:29Z")

</div>

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

> **[Component Events | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/vision/scripting-in-vision/component-events#visionwindow-event-handlers)**
>
> Event Handlers

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 5, 2024, 3:19pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/4 "2024-04-05T15:19:34Z")

</div>

> [@lrose](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Joseph\_Puente](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Joseph\_Puente](https://forum.inductiveautomation.com/u/Joseph_Puente)\
**Post date:** [April 5, 2024, 5:26pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/5 "2024-04-05T17:26:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 5, 2024, 5:36pm UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/6 "2024-04-05T17:36:25Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [April 6, 2024, 1:02am UTC](https://forum.inductiveautomation.com/t/error-executing-script-for-event-propertychange-on-component-image-2/88431/7 "2024-04-06T01:02:17Z")

</div>

> [@lrose](#):
>
> `and event.source.Out:`

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:

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

```
