Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python object has no attribute

class Obj:
	def __init__(self):
    	self.attr = 1

object = Obj()

#a valid attribute call for this object would be:

object.attr # = 1

#The error "python object has no attribute" comes from calling an attribute that
#does not exist. For example:

object.not_an_attribute

#If you get this error double check to make sure you spelled the attribute call
#correctly, or if that object has that attribute in the first place
 
PREVIOUS NEXT
Tagged: #python #object #attribute
ADD COMMENT
Topic
Name
9+7 =