N
N
NoName22813372020-06-16 14:43:11
Python
NoName2281337, 2020-06-16 14:43:11

Mistake. Threads, and something strange with def.. What to do?

Here is the code:

def onblock(heid): 
 print(heid)
heid1 = call.message.chat.id  # это равно heidi1 = 927183720
t = threading.Thread(target = onblock, args = str(call.message.chat.id)) 
t.start()

Here is the error: self._target(* self._args
, **self._kwargs)
TypeError: onblock() takes 1 positional argument but 9 were given

separately (there are 9 digits), why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-06-16
@NoName2281337

args is expecting a tuple and you are passing a string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question