TypeError: __call__() takes 3 positional arguments but 4 were given code example
Example 1: TypeError: takes 0 positional arguments but 1 was given python
When Python tells you "generatecode() takes 0 positional arguments but 1 was
given", it's telling you that your method is set up to take no arguments, but
the self argument is still being passed when the method is called, so in fact
it is receiving one argument.
Adding self to your method definition should resolve the problem.
Example 2: takes 1 positional argument but 2 were given python
This error is often caused by the fact that the self is omitted as a parameter in the method of the class.
https://careerkarma.com/blog/python-takes-one-positional-argument-but-two-were-given/#:~:text=Conclusion,the%20methods%20in%20a%20class.
0
Example 3: takes 2 positional arguments but 3 were given
# just put self in other functions like this
class myclass:
def __init__(self, parameter):
self.parameter = parameter
def function(self, otherparameter):
# put a self ^ there
print(self.parameter + otherparameter)
object=myclass(1)
object.function(2)
# output is 3