简体   繁体   中英

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM