Consider the following code: from thread import start_new def f(): typo #there is no variable called typo start_new(f, ()) If run from the command line, this produces a traceback. If run from IDLE, it does not. I suspect this is not by design. This caused me endless grief in debugging until one happy day I discovered the traceback module. I now write: from thread import start_new from traceback import print_exc def f(): try: typo except: print_exc() start_new(f, ()) this works, but I wish I didn't need it.
In 3.3, you do not need it >>> Unhandled exception in thread started by <function f at 0x00000000031D0158> Traceback (most recent call last): File "F:\Python\mypy\tem.py", line 2, in f def f(): typo #there is no variable called typo NameError: global name 'typo' is not defined In 3.2 only the first line is printed; the traceback is not. The change is due to recent internal improvements in core Python 3 exception handling. (In 3.x, thread was renamed _thread to discourage its direct use and to encourage use of threading instead. I tested with _thread.)
Mark, I ran your example against 2.7.1 and did not receive a traceback. I then ran it against the latest 2.7.3+ and receive a traceback in IDLE. Here's the entire Shell contents: Python 2.7.3+ (2.7:97445ca895d5, Jul 8 2012, 19:58:43) [GCC 4.5.2] on linux2 Type "copyright", "credits" or "license()" for more information. >>> from thread import start_new >>> def f(): typo >>> start_new(f, ()) 139804918241024Unhandled exception in thread started by <function f at 0x1e36050> >>> Traceback (most recent call last): File "<pyshell#2>", line 1, in f NameError: global name 'typo' is not defined >>>