AttributeError: 'NoneType' object has no attribute code example

Example 1: AttributeError: 'dict' object has no attribute 'iteritems'

As you are in python3 , use dict.items() instead of dict.iteritems()
iteritems() was removed in python3, so you can't use this method 
anymore. Take a look at Python 3.0 Wiki Built-in Changes section, 
where it is stated:

Removed dict.iteritems(), dict.iterkeys(), and dict.itervalues().

Instead: use dict.items(), dict.keys(), dict.values() respectively.

Example 2: 'NoneType' object has no attribute 'attname'

super().__init__(*args, **kwargs)

Example 3: AttributeError: 'module' object has no attribute 'Optimizer'

pip install tensorflow
pip install keras

Example 4: AttributeError: 'NoneType' object has no attribute

node = child.find('EmentaMateria')
if node is not None:
    ementa = node.text
else:
    ementa = None

Tags:

Misc Example