what is the attribute error in python code example

Example: attribute error python

# If python gives that error , 
# It means that whatever module doesn't have that specific function
# Therefore it can't run that specific function
# Example (recreating the error)

class Thing(object):
    
    def func(self):
        print("Random function was ran from class Thing().")

some_object = Thing()
# This will run properly
some_object.func()
# This won't run and produce the AttributeError.
some_object.some_func()

Tags:

Misc Example