簡體   English   中英

AssertionError:python線程

[英]AssertionError: python threading

我收到此錯誤,無法弄清楚它出錯的地方。 我以前沒有在python中做過線程。

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)
....
....

這是我得到的錯誤。

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

你拼錯了__init__ 另外我建議使用新的樣式繼承。

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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM