Thread.__init__() not called
Joe Smith
JoeSmith at bogusaddress.com
Tue Mar 14 18:27:50 EST 2000
I am having the following output that I am a bit confused about.
setting other info to 'other info'
setting other info to 'other info'
Traceback (innermost last):
File "D:\usr\karl\inproc\threadTest2.py", line 38, in ?
TestThreads(2)
File "D:\usr\karl\inproc\threadTest2.py", line 31, in TestThreads
thread.start()
File "d:\bin\Python1.5.2\Lib\threading.py", line 351, in start
assert self.__initialized, "Thread.__init__() not called"
AssertionError: Thread.__init__() not called
Here is a small test case the causes the problem:
import time
import threading
def DoWork(numLoops, name, otherInfo):
i = 0;
while ( i < numLoops):
print "hello from thread ", name, ", number ", i, ", other info is ",
otherInfo
time.sleep(1)
i = i + 1
class SimpleThread(threading.Thread):
def __init__(self,inOtherInfo):
self.theOtherInfo = inOtherInfo
print "setting other info to '" + self.theOtherInfo + "'"
def run(self):
try:
DoWork(20, self.getName(), self.theOtherInfo)
finally:
pass
def TestThreads(numThreads):
try:
o = "other info"
threads = []
for i in range(numThreads):
thread = SimpleThread(o)
threads.append(thread)
for thread in threads:
thread.start()
for thread in threads:
thread.join()
print "done testing loggin threads."
finally:
del o
TestThreads(2)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000314/2434e09d/attachment.html>
More information about the Python-list
mailing list