Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 481809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:01:56+00:00 2026-05-13T01:01:56+00:00

There are some similar questions, but none supply the answer I require. If I

  • 0

There are some similar questions, but none supply the answer I require.

If I create threads via threading.Thread, which then throw exceptions which are unhandled, those threads are terminated. I wish to retain the default print out of the exception details with the stack trace, but bring down the whole process as well.

I’ve considered that it might be possible to catch all exceptions in the threads, and reraise them on the main thread object, or perhaps it’s possible to manually perform the default exception handling, and then raise a SystemExit on the main thread.

What’s the best way to go about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:01:56+00:00Added an answer on May 13, 2026 at 1:01 am

    I wrote about Re-throwing exceptions in Python, including something very much like this as an example.

    On your worker thread you do this (Python 3.x, see below for Python 2.x version):

    try:
        self.result = self.do_something_dangerous()
    except Exception as e:
        import sys
        self.exc_info = sys.exc_info()
    

    and on your main thread:

    if self.exc_info:
        raise self.exc_info[1].with_traceback(self.exc_info[2])
    return self.result
    

    Python 2.x:

    try:
        self.result = self.do_something_dangerous()
    except Exception, e:
        import sys
        self.exc_info = sys.exc_info()
    

    and on your main thread you do this:

    if self.exc_info:
        raise self.exc_info[1], None, self.exc_info[2]
    return self.result
    

    The exception will appear in the main thread just as if it had been raised in the worker thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are some similar questions like this already, but none of those fixes worked
There have been some similar questions asked regarding Grid views, but none have been
There have been some similar questions in stackoverflow but none of them answers my
I see there are some similar questions to this, but none solve my issue.
I know there have been some similar questions to this, but they haven't helped
There might be similar questions but I still have some parts that I couldn't
Although there are some similar questions I’m having difficulties finding an answer on how
I know that there are some threads have a similar issue with this thread.
I found a lot of similar questions out there but none that really answered
There are a few similar questions to this but none quite the same. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.