TypeError in Threading. function takes x positional argument but y were given
Solution 1:
The args
kwarg of threading.Thread
expects an iterable, and each element in that iterable is being passed to the target function.
Since you are providing a string for args
:t = threading.Thread(target=startSuggestworker, args=(start_keyword))
each character is being passed as a separate argument to startSuggestworker
.
Instead, you should provide args
a tuple:
t = threading.Thread(target=startSuggestworker, args=(start_keyword,))
# ^ note the comma