question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: object.__init__() takes no parameters

See original GitHub issue

Reported by TwoCubed on irc.

https://github.com/kivy/kivy/blob/master/examples/widgets/settings.py

 Traceback (most recent call last):
   File "E:\dev\envs\py34_x86\kivy\examples\widgets\settings.py", line 93, in <module>
     SettingsApp().run()
   File "e:\dev\envs\py34_x86\kivy\kivy\app.py", line 825, in run
     runTouchApp()
   File "e:\dev\envs\py34_x86\kivy\kivy\base.py", line 487, in runTouchApp
     EventLoop.window.mainloop()
   File "e:\dev\envs\py34_x86\kivy\kivy\core\window\window_sdl2.py", line 606, in mainloop
     self._mainloop()
   File "e:\dev\envs\py34_x86\kivy\kivy\core\window\window_sdl2.py", line 361, in _mainloop
     EventLoop.idle()
   File "e:\dev\envs\py34_x86\kivy\kivy\base.py", line 330, in idle
     self.dispatch_input()
   File "e:\dev\envs\py34_x86\kivy\kivy\base.py", line 315, in dispatch_input
     post_dispatch_input(*pop(0))
   File "e:\dev\envs\py34_x86\kivy\kivy\base.py", line 221, in post_dispatch_input
     listener.dispatch('on_motion', etype, me)
   File "kivy\_event.pyx", line 717, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7635)
   File "e:\dev\envs\py34_x86\kivy\kivy\core\window\__init__.py", line 986, in on_motion
     self.dispatch('on_touch_down', me)
   File "kivy\_event.pyx", line 717, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7635)
   File "e:\dev\envs\py34_x86\kivy\kivy\core\window\__init__.py", line 1002, in on_touch_down
     if w.dispatch('on_touch_down', touch):
   File "kivy\_event.pyx", line 717, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7635)
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\widget.py", line 438, in on_touch_down
     if child.dispatch('on_touch_down', touch):
   File "kivy\_event.pyx", line 717, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7635)
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\behaviors.py", line 183, in on_touch_down
     self.dispatch('on_press')
   File "kivy\_event.pyx", line 713, in kivy._event.EventDispatcher.dispatch (kivy\_event.c:7590)
   File "kivy\_event.pyx", line 1223, in kivy._event.EventObservers.dispatch (kivy\_event.c:13325)
   File "kivy\_event.pyx", line 1147, in kivy._event.EventObservers._dispatch (kivy\_event.c:12851)
   File "e:\dev\envs\py34_x86\kivy\kivy\app.py", line 913, in open_settings
     self._app_settings = self.create_settings()
   File "e:\dev\envs\py34_x86\kivy\kivy\app.py", line 984, in create_settings
     s.add_kivy_panel()
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\settings.py", line 1004, in add_kivy_panel
     join(kivy_data_dir, 'settings_kivy.json'))
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\settings.py", line 944, in add_json_panel
     panel = self.create_json_panel(title, config, filename, data)
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\settings.py", line 984, in create_json_panel
     instance = cls(panel=panel, **str_settings)
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\label.py", line 248, in __init__
     super(Label, self).__init__(**kwargs)
   File "e:\dev\envs\py34_x86\kivy\kivy\uix\widget.py", line 312, in __init__
     super(Widget, self).__init__(**kwargs)
   File "kivy\_event.pyx", line 253, in kivy._event.EventDispatcher.__init__ (kivy\_event.c:4863)
 TypeError: object.__init__() takes no parameters

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
mathamcommented, Oct 14, 2015

The problem occurs because we forward up our inheritance chain any kwargs we don’t use. And in python 3, anything that was not eaten by the time we call the highest class, i.e. object will cause a error. I.e. calling super on object must call with empty kwargs.

Now, what does kivy eat in kwargs? Any kwargs key that is a property name will be eaten. That’s because kivy uses it to set the property value, and as per the rules, when it’s used it’s removed from kwargs. So, if you pass something on to super that is not a kivy prop, kivy will forward up the chain and cause an exception when it’s passed to super.

0reactions
nikhilraj1321commented, Mar 29, 2017

Essentially what you are resolving to is the init of the object base class which takes no params.

Its a bit redundant, I know, to have to specify the class that you are already inside of, which is why in python3 you can just do: super().init()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python inheritance: TypeError: object.__init__() takes ...
Essentially what you are resolving to is the __init__ of the object base class which takes no params. Its a bit redundant, I...
Read more >
Python TypeError: object() takes no arguments Solution
The “TypeError: object() takes no arguments” error is raised when you do not declare a method called __init__ in a class that accepts...
Read more >
TypeError: object.__init__() takes no parameters - Python
I'm having trouble a TypeError. Whenever I create a new HighSchool object I get the error: “TypeError: object.init() takes no parameters”.
Read more >
Python inheritance TypeError object init takes no parameters
I get this error: TypeError: object.__init__() takes no parameters when running my code, I ... ): super(IRCReplyModule,self).
Read more >
ERROR: object.__init__() takes no parameters #1588 - GitHub
Hello guys when I try to open connection from my frontend to my socket this error I get can you help me? 2020-12-05...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found