Use this with questions involving the Python `AttributeError` exception. Use the more general "Python" tag as well when using this tag.
Explanation
In Python, an AttributeError
is raised when:
... an attribute reference or assignment fails.
In other words, this happens when you try to access an attribute of an object or a class which does not exist.
Example
For example, trying to do:
import math
math.cuberoot(27)
raises an AttributeError
similar to:
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
math.cuberoot(27)
AttributeError: 'module' object has no attribute 'cuberoot'
because the math
module does not define a function called cuberoot
.
Documentation
For more information, see the Python documentation on Attribute References.