TypeError: connect () takes at least 4 arguments (4 given) Oh ok that makes sense...

  • 1
    The type error should really tell you more, like the args you passed versus the args the function requires. I've run into this before and thought WTF Python??
  • 0
    Maybe the args' order. Maybe some of them got the wrong class. Maybe the namespace is polluted and there are to entities with the same name.

    This is my recipe for this kind of issue.

    Disclaimer: Don't know any Python.
  • 0
    Is one of them supposed to be 'self'?
  • 0
    Nope, this is just some crazy error I got from using some python module.
  • 0
    It's because you've supplied 4 arguments, but those arguments are not the arguments the function requires. So the connection function takes AT LEAST 4 arguments. You ended up passing 4 arguments, just not the ones required at minimum to call it. Again the TypeError is not helpful at all in showing you this.
  • 0
    You get this error when you have a method that takes 4 arguments positional (counting 'self' if it is an instance method), but also accepts optional named arguments. In your case, you called the method with fewer than the 4 leading args, but added some of the named args, enough to add back up to 4.
Add Comment