1 positional arguments expected but 2 were given

Solutions on MaxInterview for 1 positional arguments expected but 2 were given by the best coders in the world

showing results for - "1 positional arguments expected but 2 were given"
Sofia
27 Jan 2021
1#Happens when a function expects only 1 value to be passed through it
2#But multiple are passed through
3
4class thing(object):
5	def __init__(self):
6    	pass
7       
8    def function(self)
9		print("hello")
10
11thingy = thing()
12thingy.bind("<KeyPress>", thingy.function)
13
14#You don't expect above to pass two values through, however it passes an event
15#and self which is why it will give a positional argument error
queries leading to this page
takes 1 positional argument but 2 were given python inheritance2 positional argument 28s 29 expected 2c but 0 found wrong number of arguments 28given 0 2c expected 1 29expected 2 arguments got 1typeerror 3a method 28 29 takes 1 positional argument but 2 were giventypeerror 3a init 28 29 takes 2 positional arguments but 3 were given init 28 29 takes 1 positional argument but 2 were giventypeerror 3a setup 28 29 takes 1 positional argument but 2 were giventakes 1 positional argument but 2 were given python dicttypeerror 3a api 28 29 takes 1 positional argument but 2 were givenfile 2 positional argument 28s 29 expected 2c but 1 found json dumps error takes 1 positional argument but 2 were given write 28 29 needs 1 argument but 2 were giventypeerror 3a standarddeviation 28 29 takes 1 positional argument but 2 were given listtypeerror 3a is valid bst 28 29 takes 1 positional argument but 2 were giventakes 1 positional argument but 2 were given when passing a tupple pythonarray 28 29 takes from 1 to 2 positional arguments but 5 were giventype error takes 1 positional argument but 2 were given python classtypeerror 3a index 28 29 takes 0 positional arguments but 2 were given2 positional argument 28s 29 expected 2c but 1 found python method takes no arguments 281 given 292 positional argument 28s 29 expected 2c but 1 found in fileobject takes 1 positional argument but 2 were giventypeerror 3a stat 28 29 takes 1 positional argument but 2 were giventypeerror 3a unlink 28 29 takes 1 positional argument but 2 were given odoofunction takes 1 positional argument but 2 were given pythonexpression 24in takes exactly 2 arguments 1 were passed in1 positional arguments expected but 2 were given init 28 29 takes 1 positional argument but 3 were giventypeerror 3a reverseprint 28 29 takes 1 positional argument but 2 were given1 positional arguments expected but 2 were given