Unhandled exception in thread

ryles rylesny at gmail.com
Sat Jun 13 00:55:14 EDT 2009

On Jun 11, 3:52 pm, Mads Michelsen <madsmaill... at gmail.com> wrote:
> Here's the deal. The script in question is a screen scraping thing
> which downloads and parses the html in the background using a separate
> thread (the 'thread' module), while the main program serves up the
> data to the user, allowing some modicum of interaction. Sometimes, not
> always (though I cannot see a pattern), when I quit the script, the
> following error message is printed:
>     Unhandled exception in thread started by
>     Error in sys.excepthook:
>     Original exception was:

Are you using daemon threads? There are some issues with CPython when
exiting with daemon threads:




It's possible you are encountering this kind of problem. I have had to
deal with issue4106, the workaround being to explicitly join the
thread of multiprocessing.Queue before exiting.

I would follow Scott's advice and explicitly request and wait for your
threads to exit before terminating the process.

More information about the Python-list mailing list