# AttributeError: 'NoneType' object has no attribute

**URL:** <https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346>\
**Category:** Ignition\
**Created:** [November 10, 2016, 8:14pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346 "2016-11-10T20:14:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dturner](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dturner](https://forum.inductiveautomation.com/u/dturner)\
**Post date:** [November 10, 2016, 8:14pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/1 "2016-11-10T20:14:29Z")

</div>

I am receiving the error below when using the attached code. I checked the help and saw that selectedStringValue is a valid property. I can comment out any of the line and get the same error just a reference to the next line. Is there something I am missing?

Error Message:  
Traceback (most recent call last):

File “event:actionPerformed”, line 1, in   
File “module:project.Insert\_Shift\_Info”, line 3, in Insert\_Shift\_Information  
AttributeError: ‘NoneType’ object has no attribute ‘selectedStringValue’

Ignition v7.7.4

Code

[code]def Insert\_Shift\_Information(event):  
window = system.gui.getParentWindow(event).rootContainer  
strShift = window.getComponent(“Shift\_Dropdown”).selectedStringValue  
Date = “’” + window.getComponent(“Shift\_Date\_Select\_Calendar”).formattedDate[:10] + “’”  
strLine\_Name = “’” + window.getComponent(“Line\_Name\_Dropdown”).selectedStringValue + “’”  
intParts\_Produced = window.getComponent(“Parts\_Made\_Numeric\_Text\_Field”).intValue   
intScheduled\_Parts = window.getComponent(“Parts\_Scheduled\_Numeric\_Text\_Field”).intValue

```
system.db.runUpdateQuery("INSERT INTO Shift_Information (Line, Date, Shift, Parts_Produced, Scheduled_Parts) VALUES (%s, %s, %s, %s, %s)" % (strLine_Name, Date, strShift, intParts_Produced, intScheduled_Parts))[/code]
```

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [November 10, 2016, 9:02pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/2 "2016-11-10T21:02:03Z")

</div>

Hi dturner,

There error that you are getting means that the component path you are using, “Shift\_Dropdown” does not exist, so None is being returned by the call to getComponent. Are you sure that the “Shift\_Dropdown” component is in the root container? Are you sure you spelled the name of the component exactly as it appears in the Project Browser in the designer? Are you sure you are getting the right window?

Best,

---

<div class="post-metadata">

**Author:** ![dturner](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dturner](https://forum.inductiveautomation.com/u/dturner)\
**Post date:** [November 10, 2016, 9:22pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/3 "2016-11-10T21:22:06Z")

</div>

I copied and pasted the component name into the script and received the same error. This is the parent window. The script is being launched from a button press. I’ve attached the tree in Designer.

---

<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:** [November 11, 2016, 12:52pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/4 "2016-11-11T12:52:11Z")

</div>

You’re missing the “rootContainer” property between “window” and “getComponent()”.

---

<div class="post-metadata">

**Author:** ![dturner](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dturner](https://forum.inductiveautomation.com/u/dturner)\
**Post date:** [November 11, 2016, 2:27pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/5 "2016-11-11T14:27:22Z")

</div>

Do I need to put that again even though I have it in the variable window = system.gui.getParentWindow(event).rootContainer?

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [November 11, 2016, 4:10pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/6 "2016-11-11T16:10:06Z")

</div>

Use the property reference browser to get the correct path to the component along with the property name.

---

<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:** [November 11, 2016, 4:25pm UTC](https://forum.inductiveautomation.com/t/attributeerror-nonetype-object-has-no-attribute/12346/7 "2016-11-11T16:25:03Z")

</div>

[quote=“dturner”]Do I need to put that again even though I have it in the variable window = system.gui.getParentWindow(event).rootContainer?[/quote]Whoops, I missed that. No.
