[Python-bugs-list] [Bug #121963] IDLE hangs on Threads

noreply@sourceforge.net noreply@sourceforge.net
Tue, 14 Nov 2000 12:34:42 -0800

Bug #121963, was updated on 2000-Nov-08 05:52
Here is a current snapshot of the bug.

Project: Python
Category: IDLE
Status: Closed
Resolution: Later
Bug Group: Feature Request
Priority: 5
Summary: IDLE hangs on Threads

Details: everytime my python- program starts a thread under IDLE it crashes. i use Windows 2000 and Python 2.0


Date: 2000-Nov-13 12:35
By: gvanrossum

Please provide more detail. What code do you use to start a thread? Does that code run correctly when using the command line interpreter (python.exe)? What kind of message do you get from the crash?

Date: 2000-Nov-13 15:11
By: tim_one

Under Win98SE, I don't see a crash but a hang is very easy to provoke (the bug report is unclear about which is happening).  For example:

def f():
    for i in range(100): print "hi", i
import thread
thread.start_new_thread(f, ())

From within IDLE, this freezes solid after a "random" number of prints, and whether typed in directly or run from a file ("Run script" from IDLE Edit menu).  Have to kill the shell from the Task Manager.

A possibly different symptom can be provoked by typing

from test import test_thread

from the IDLE prompt.

I don't think this is anything new; I always figured that threads & IDLE don't mix, and never thought more about it.


Date: 2000-Nov-14 09:13
By: none

sorry that my comment was not clear enough. my prog works when it's running under the command line interpreter. there's no error message, it just hangs. 
here's my code:

from threading import *

class MyThread(Thread):
   def __init__(self, aData):

   def run(self):
       for i in range(10):
          print self.mData

if __name__=="__main__":




that's it. we did this at school and my system is a Dual Pentium II with 2 x 400 Mhz and 256Mb.


Date: 2000-Nov-14 09:31
By: gvanrossum

Ah.  Yes, printing from threads started under IDLE doesn't work, and in general using threads under IDLE isn't safe.   This is not platform specific!

This isn't easy to fix; the best solution will be (eventually) to run the program in a subprocess instead of as a module in the IDLE process, but thta requires significant architectural changes to IDLE.

For the short term, the solution is to run your program from the command line, or to avoid threads if you want to run nder IDLE.


Date: 2000-Nov-14 12:34
By: tim_one

Changed to Feature Request and added to PEP42.

For detailed info, follow this link: