By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,660 Members | 1,102 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

threaded code in IDLE

P: n/a
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
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Matt Leslie <ma***********@hotmail.com> writes:
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....)

--
KBK
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.