[Python-bugs-list] [ python-Bugs-440464 ] Threading Program Crashes Python 2.1

noreply@sourceforge.net noreply@sourceforge.net
Wed, 11 Jul 2001 11:16:45 -0700


Bugs item #440464, was opened at 2001-07-11 11:13
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=440464&group_id=5470

Category: IDLE
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Threading Program Crashes Python 2.1

Initial Comment:
import threading
from time import time, ctime, sleep

class MyClass(threading.Thread):
    def __init__(self, args):
        threading.Thread.__init__(self)
        self.args = args

    def run(self):
        while 1:
            print self.args

    def printText(self, foo):
        self.foo = foo
        print self.foo

Biff = MyClass(4)
Biff.start()    
Biff.printText("This is a string!")


The above code crashes IDLE when run under NT4. The 
error message I get is this:

4Traceback (most recent call last):
  File "C:\Python21\Tools\idle\idle.pyw", line 2, in ?
    import idle
  File "C:\Python21\Tools\idle\idle.py", line 12, in ?
    PyShell.main()
  File "C:\Python21\Tools\idle\PyShell.py", line 777, 
in main
    root.mainloop()
  File "c:\python21\lib\lib-tk\Tkinter.py", line 930, 
in mainloop
    self.tk.mainloop(n)
  File "c:\python21\lib\lib-tk\Tkinter.py", line 1289, 
in __call__
    self.widget._report_exception()
  File "c:\python21\lib\lib-tk\Tkinter.py", line 1061, 
in _report_exception
    root.report_callback_exception(exc, val, tb)
  File "c:\python21\lib\lib-tk\Tkinter.py", line 1541, 
in report_callback_exception
    sys.stderr.write("Exception in Tkinter callback\n")
  File "C:\Python21\Tools\idle\PyShell.py", line 676, 
in write
    self.shell.write(s, self.tags)
  File "C:\Python21\Tools\idle\PyShell.py", line 663, 
in write
    OutputWindow.write(self, s, tags, "iomark")
  File "C:\Python21\Tools\idle\OutputWindow.py", line 
37, in write
    self.text.insert(mark, str(s), tags)
  File "C:\Python21\Tools\idle\Percolator.py", line 
25, in insert
    self.top.insert(index, chars, tags)
  File "C:\Python21\Tools\idle\PyShell.py", line 143, 
in insert
    UndoDelegator.insert(self, index, chars, tags)
  File "C:\Python21\Tools\idle\UndoDelegator.py", line 
81, in insert
    self.addcmd(InsertCommand(index, chars, tags))
  File "C:\Python21\Tools\idle\UndoDelegator.py", line 
116, in addcmd
    cmd.do(self.delegate)
  File "C:\Python21\Tools\idle\UndoDelegator.py", line 
216, in do
    if text.compare(self.index1, ">", "end-1c"):
  File "c:\python21\lib\lib-tk\Tkinter.py", line 2626, 
in compare
    return self.tk.getboolean(self.tk.call(
TclError: expected boolean value but got ""
Hit return to exit...

Sometimes IDLE just dies all together w/o displaying 
anything.

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-07-11 11:16

Message:
Logged In: YES 
user_id=6380

Alas, using threads and Tkinter together does not work, and
since IDLE is Tkinter-based, you can't do much with threads
in IDLE.

Your example should work fine in the command-line
interpreter.

I'm closing this bug report since there's really nothing we
can do about this.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=440464&group_id=5470