passing argumetns to threading.Thread
sashan
mabus at operamail.com
Sat Oct 4 22:13:09 EDT 2003
sashan wrote:
> sashan wrote:
>
>> I'm trying to pass arguments to my the run method of my class that
>> inherits from threading.Thread.
>>
>> class Reader(threading.Thread):
>> def __init__(self, conn):
>> threading.Thread.__init__(self, None, None, None, (conn))
>> def run(self,conn): while 1:
>> data = conn.recv(1024)
>> print data
>>
> woops left out some stuff...
>
> later in the program:
>
> t = Reader(conn)
> t.start()
>
sorry ... i keep hitting the wrong shortcut key combom when sending
these messages resulting in truncations
Anyway after t.start() I get an error message basically saying:
TypeError: 2 arguments expected for Reader.run (1 given)
How do I resolve this?
More information about the Python-list
mailing list