# AttributeError: 'NoneType' object has no attribute 'motorNumber'

**URL:** <https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 4, 2020, 9:57pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927 "2020-02-04T21:57:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wattersm](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@wattersm](https://forum.inductiveautomation.com/u/wattersm)\
**Post date:** [February 4, 2020, 9:57pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/1 "2020-02-04T21:57:35Z")

</div>

I have a popup window that is throwing errors when it is opened. motorNumber is a custom property that is defined in the custom properties for the window. Does anybody know what would cause this?

Below is a full stack trace.

```auto
CD-Key
n/a
User
User Name
user.name@foo.com
User Message
This error occurs when the script event for the spinner is activated. There is a custom property that is not being passed properly.
Error Message
Error executing script for event: mouseClicked
on component: Root Container.
Error Details
Traceback (most recent call last):
File "", line 6, in
AttributeError: 'NoneType' object has no attribute 'motorNumber'

    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._pyx3.f$0(:10)
    at org.python.pycode._pyx3.call_function()
    at org.python.core.PyTableCode.call(PyTableCode.java:171)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.Py.runCode(Py.java:1614)
    at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:761)
    at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:187)
    at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:278)
    at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
    at com.sun.proxy.$Proxy47.mouseClicked(Unknown Source)
    at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
    at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.Component.processEvent(Unknown Source)
    at java.desktop/java.awt.Container.processEvent(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(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(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    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)
System Details
fpmi.client.memory.used=93.00
fpmi.client.memory.max=1024.00
fpmi.client.type=null
fpmi.client.version=null
java.vm.version=11.0.4+11-LTS
java.vm.vendor=Azul Systems, Inc.
java.vm.name=OpenJDK 64-Bit Server VM
user.country=US
os.name=Linux
os.arch=amd64
sun.os.patch.level=unknown
os.version=3.10.0-1062.9.1.el7.x86_64
java.specification.version=11
user.language=en
ignition.gateway.version=8.0.5 (b2019101516)
ignition.gateway.memory.used=1024.00
ignition.gateway.memory.max=2048.00
ignition.gateway.uptime=50 days, 7 hours, 6 minutes, 30 seconds
ignition.module.com.inductiveautomation.alarm-notification=5.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.ablegacy=5.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.dnp3=3.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.eam=3.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.logix=4.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.modbus=6.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.omron=3.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua=8.0.5 (b2019101517) - RUNNING
ignition.module.com.inductiveautomation.perspective=1.0.5 (b2019101517) - RUNNING
ignition.module.com.inductiveautomation.reporting=5.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.sfc=4.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.siemens=5.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.sms-notification=5.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.sqlbridge=9.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.symbol-factory=6.0.5 (b2019101516) - LOADED
ignition.module.com.inductiveautomation.taghistorian=3.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.opcua.drivers.tcpudp=5.0.5 (b2019101516) - RUNNING
ignition.module.com.inductiveautomation.vision=10.0.5 (b2019101517) - RUNNING
fpmi.client.memory.used=93.00
fpmi.client.memory.max=1024.00
fpmi.client.type=null
fpmi.client.version=null
java.vm.version=11.0.4+11-LTS
java.vm.vendor=Azul Systems, Inc.
java.vm.name=OpenJDK 64-Bit Server VM
user.country=US
os.name=Linux
os.arch=amd64
sun.os.patch.level=unknown
os.version=3.10.0-1062.9.1.el7.x86_64
java.specification.version=11
user.language=en

```

---

<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:** [February 4, 2020, 10:20pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/2 "2020-02-04T22:20:02Z")

</div>

Please show the code. Note that the report says the error is in line #6.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 4, 2020, 11:06pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/3 "2020-02-04T23:06:45Z")

</div>

Line 6 of your code has _something_.motorNumber. The problem is _something_ is not found (NoneType). Based on the information provided, you likely want to find it like this:

```python
event.source.motorNumber

```

`event.source` gets the clicked object “Root Container” and `.motorNumber` gets the custom property on the root container.

---

<div class="post-metadata">

**Author:** ![wattersm](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@wattersm](https://forum.inductiveautomation.com/u/wattersm)\
**Post date:** [February 10, 2020, 2:39pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/4 "2020-02-10T14:39:14Z")

</div>

Sorry for the delay, I’ve been traveling the last few weeks. Here’s the code that was generated by the designer on my spinner object.

```auto
# This script was generated automatically by the navigation
# script builder. You may modify this script, but if you do,
# you will not be able to use the navigation builder to update
# this script without overwriting your changes.

param1 = event.source.intValue

window = system.nav.openWindow('Popups/MotorPopup', {'motorNumPopup' : param1})

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 10, 2020, 3:14pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/5 "2020-02-10T15:14:43Z")

</div>

That’s not the code which generated the error you posted previously.

---

<div class="post-metadata">

**Author:** ![wattersm](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@wattersm](https://forum.inductiveautomation.com/u/wattersm)\
**Post date:** [February 10, 2020, 5:20pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/6 "2020-02-10T17:20:41Z")

</div>

I guess I’m not sure where to look then. The error occurs when I click on the spinner object which is supposed to open a popup window by passing through the custom parameter. Everything I’ve done was configured using the designer.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 10, 2020, 5:23pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/7 "2020-02-10T17:23:27Z")

</div>

You need to look on the Root Container in the mouseClicked Event. At least, that’s according to the logging you posted.

---

<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:** [February 10, 2020, 5:25pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/8 "2020-02-10T17:25:46Z")

</div>

The original error says the flaw is in the mouseClicked event of the root container. Please show that code. In the popup, perhaps.

---

<div class="post-metadata">

**Author:** ![wattersm](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@wattersm](https://forum.inductiveautomation.com/u/wattersm)\
**Post date:** [February 10, 2020, 8:15pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute-motornumber/31927/9 "2020-02-10T20:15:26Z")

</div>

I’ve managed to get this working by switching the template to use UDT tags. Not sure what I did wrong before but thanks for all of the help.
