threaded code in IDLE

M

Matt Leslie

This code:

**************
import thread

def doprint(i):
print i

for i in range(0,100):
thread.start_new_thread(doprint,(i,))
*************

Will run fine from the windows command line, but consistently
crashes IDLE on windows (it locks up with no error message)

Is this a known bug?

Is there a workaround?

Thanks,
Matt
 
K

Kurt B. Kaiser

Matt Leslie said:
This code:

**************
import thread

def doprint(i):
print i

for i in range(0,100):
thread.start_new_thread(doprint,(i,))
*************

Will run fine from the windows command line, but consistently
crashes IDLE on windows (it locks up with no error message)

Is this a known bug?

Which IDLE? Which Python? Which Windows?

Works for me on Windows2000, Python 2.3.2, Idle 1.0


If I run a thousand threads IDLE uses over 64MB unless I add a little
delay in between spawning threads. Using the Python interpreter, not
IDLE, I can add a time.sleep(.0000015) and get away with 10,000
threads piling up with output to print. IDLE needs more time, try .01
sec and watch your Task Monitor. (Though 100 threads isn't much of
a load....)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,947
Members
47,501
Latest member
Ledmyplace

Latest Threads

Top