Kaka
Kaka

Reputation: 37

AssertionError: python threading

I got this error and can't figure out where it went wrong. I haven't done threading in python before.

class ClientThread(threading.Thread):

    def __int__(self,ip,port,socket):
        threading.Thread.__int__(self)
        self.ip = ip
        self.port = port
        self.socket = socket
        print "New thread started for "+ip+":"+str(port)

    def run(self):
    ....
    ....


(clientsock, (ip,port)) = serverSocket.accept()

# Create new thread
newthread = ClientThread(ip,port,clientsock)
....
....

This is the error I got.

newthread = ClientThread(ip,port,clientsock)
AssertionError: group argument must be None for now

Upvotes: 0

Views: 3321

Answers (1)

lehins
lehins

Reputation: 9767

You misspelled __init__. Also I'd recommend using new style inheritance.

class ClientThread(threading.Thread):

    def __init__(self, ip, port, socket):
        super(ClientThread, self).__init__()
        self.ip = ip
        self.port = port
        self.socket = socket
        print "New thread started for "+ip+":"+str(port)

Upvotes: 2

Related Questions