I was writing a wrapper method when the error occurred. I've managed to simplify the problem to the following piece of code:
def func1(data, **kwargs):
func2(data, kwargs)
def func2(data, **kwargs):
print(data)
The TypeError: func2() takes 1 positional argument but 2 were given
appears when running func1
.
Regardless of what named arguments I put into the function call, the error occurs. However, if I don't pass kwargs
to func2
, everything runs smoothly.
Most of the information I found about the error message dealt with class methods not calling self
, which is not the case.