I'm currently using Vizard 3.0 and having trouble getting a simple multithreaded application to run. I wrote a script in IDLE using Python 2.3 (the same version as Vizard) and it works as expected. When it is run in Vizard, however, I get the following error:
"Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:"
The code is pretty simple and, as I said before, works as expected in IDLE.
Code:
import thread
def countingThread(id, maxVal):
global printLock
for i in range(maxVal):
printLock.acquire()
print "Thread ", id, ": ", i
printLock.release()
global printLock
printLock = thread.allocate_lock()
for i in range(5):
thread.start_new_thread(countingThread, (i, 50))
Any help would be greatly appreciated!!