Skip to content Skip to sidebar Skip to footer

Python: Typeerror: Argument After * Must Be A Sequence

I have this piece of code in which I try to send an UDP datagram in a new thread import threading, socket address = ('localhost', 9999) def send(sock): sock.sendto('Message'

Solution 1:

You need to add a comma - , - after your variable s. Sending just s to args=() is trying to unpack a number of arguments instead of sending just that single arguement.

So you'd have threading.Thread(target=send, args=(s,)).start()

Also the splat - * - operator might be useful in this question explaining it's usage and unzipping arguments in general

Post a Comment for "Python: Typeerror: Argument After * Must Be A Sequence"