Python Forum
takes 21 positional arguments but 24 were given
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
takes 21 positional arguments but 24 were given
#1
I have a positional argument issue. What needs to be changed?

Error:
"line 277, in <module> ld2 TypeError: mapTraverse() takes 21 positional arguments but 24 were given":
              key, counter, rewardTotal, accuracyHD1, accuracyHD2, newRewardLocation, pointerHD1, pointerHD2, reward1, reward2, ld1, ld2 = sups.mapTraverse(win,
                                                allMapParams[mapDispOrder[mp]][0],
                                                allMapParams[mapDispOrder[mp]][2],
                                                allMapParams[mapDispOrder[mp]][1],
                                                allMapParams[mapDispOrder[mp]][3], 
                                                allMapParams[mapDispOrder[mp]][4],
                                                stateLevels, 
                                                block, 
                                                key, 
                                                counter,
                                                fixationRange,
                                                writer,
                                                maxWaitResponse,
                                                newRewardLocation,
                                                rewardTotal,
                                                [-1], # reward1
                                                -1, # reward2
                                                accuracyHD1,
                                                accuracyHD2,
                                                accuracyCheckFrequency,
                                                pointerHD1,
                                                pointerHD2,
                                                ld1,
                                                ld2
                                                )
Reply
#2
Hi,

well, the error message is crystal clear: you call a function or method with 24 arguments, but the function / method only accepts / expects 21. So your function call is wrong.

You may want to consult the documentation of the function / method you use to get more details, respectively which arguments are expected.

By the way: 21 positional arguments is super weird, no good design. For this number, the use of keyword arguments is way better. However wrote this function / method...

Regards noisefloor
Reply
#3
Quote:21 positional arguments
Shocked Just pass a dictionary to the function instead.
Recommended Tutorials:
Reply
#4
(Jun-20-2019, 07:20 PM)noisefloor Wrote: By the way: 21 positional arguments is super weird

And 12 return values!
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
You think this is abnormal?
https://bugs.python.org/issue12844
Big Grin Big Grin
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#6
Doh
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Class takes no arguments bily071 2 633 Oct-23-2023, 03:59 PM
Last Post: deanhystad
  Error TypeError: output_type_handler() takes 2 positional arguments but 6 were given paulo79 1 1,935 Oct-17-2022, 06:29 PM
Last Post: paulo79
  Error: _vhstack_dispatcher() takes 1 positional argument but 9 were given alexfrol86 3 5,804 May-09-2022, 12:49 PM
Last Post: deanhystad
  TypeError: missing 3 required positional arguments: wardancer84 9 10,850 Aug-19-2021, 04:27 PM
Last Post: deanhystad
  Checking the number of arguments a function takes Chirumer 3 2,153 Jul-06-2021, 04:56 PM
Last Post: Chirumer
  TypeError: max_value() missing 2 required positional arguments: 'alpha' and 'beta' Anldra12 2 4,202 May-15-2021, 04:15 PM
Last Post: Anldra12
  Class Takes No Arguments horuscope42 4 4,817 Oct-26-2020, 11:10 PM
Last Post: not_username1234
  How to reuse positional arguments entered in terminal. rcmanu95 1 1,872 Jul-04-2020, 01:00 AM
Last Post: bowlofred
  Class takes no arguments Nazartfya 2 4,565 Jun-27-2020, 12:45 PM
Last Post: Nazartfya
  Why Car() takes no arguments louis216 2 2,604 Jun-25-2020, 03:16 AM
Last Post: louis216

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020