AttributeError: 'NoneType' object has no attribute 'props'

Here is my project

image

I am creating a script inside of the CommitButton:

def getComponentEntries(self):
	component_label = self.getSibling("CompLabel")
	entries = self.getSibling('Entries')
	entries_dict = {}
	for ent in entries.getChildren():
		if "Entry" in ent.meta.name:
			entries_dict[str(ent.getChild('Label').props.text).lower()] = ent.getChild('NumericalEntryField').props.value
	return component_label.props.text, entries_dict

When I run this script inside of the runAction for clicking the commit button however, I get the error

Error running action 'dom.onClick' on Hermes@D/root/Layout/AddCompPopup/CommitButton: Traceback (most recent call last): File "<function:runAction>", line 2, in runAction File "<custom-method getComponentEntries>", line 10, in getComponentEntries AttributeError: 'NoneType' object has no attribute 'props' 

All of these children should have props but for some reason it is inaccessible.

Any assistance is appreciated. Thanks!

One of your “entries” didn’t have a child named “Label”. Or didn’t have a child named “NumericalEntryField”. Or CompLabel itself didn’t exist as a sibling.

{ Which line is line #10? Consider breaking up the component access into separate lines so the error is more obvious. )

The issue was that the items are called NumericEntryField not NumericalEntryField. It was just a subtle typo.

1 Like