AttributeError: ‘super’ object has no attribute ‘__getattr__’ [Troubleshooting: Kivy]

Spread the word!

ERROR:

HOW I SOLVED IT:

In my code I had these lines causing the error

I solved it by adding the **kwargs as parameter of __init__ and executing the super.(my_class_name, self).__init__(**kwargs) as first command inside it. Here the modified working code:

STILL NOT SOLVED?

Try the following solutions:

  • Make sure that the class rule in the .kv file has the same name as the corresponding class defined in your .py file. Considering the previous example, if the class is called “test”, than you should have a “<test>:” in your .kv file.
  • How did you define your widgets ids? If you do it in your .kv file, don’t set the id as a string but remove the quotation marks (i.e.: id: “someid” is WRONG, instead id: someid is fine). If you defined your ids in the Python code, they will not be accessible using the self.ids property, since it’s a dictionary containing the ids parsed in the .kv file. References to your widgets dinamically created in your Python code can be obtained by storing them into a variable.

To know more about the structure of a Kivy program, consider reading this introduction.

1 Comment

  1. Hello sir, I am also getting the same error but not being able to resolve it—

    def wake_time_picker(self):
    self.time_dialog=MDTimePicker()
    self.time_dialog.bind(time=self.show)
    self.time_dialog.open()
    def show(self,instance,time):
    self.sm.get_screen('ninput').ids.self.dynamic_ip.text = str(time)

Leave a Reply

Your email address will not be published.


*