Unhandled exception in thread

M

Mads Michelsen

(I'll ask you to bear with the somewhat vague description in advance -
I'm a noob in all respects here, with regard to python and the mailing
list)

I'm getting some error reports sometimes when I quit a script, I've
been working on. The reports are extremely uninformative, and I do not
notice anything wrong in the script's behaviour, which makes the error
very hard to pin down. I'm therefore looking for advice on a way that
I can investigate the error.

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:

And that's it! Seems like there's some information missing? What is
the error in sys.excepthook? What was the original exception? And
where?

Any suggestions on how to proceed?

- Mads
 
R

ryles

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:

http://bugs.python.org/issue1722344

http://bugs.python.org/issue1856

http://bugs.python.org/issue4106

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top