P
Peter Hansen
dcrespo said:In my above example, I want to catch in ProgramA the raised exception
in ProgramB.
Better not to call them "programs" since they're not separate programs,
just separate modules, one of which starts a thread using methods in the
other module.
And you haven't really answered the questions I asked. Please show
exactly where you expect to catch the exception, given the points I note
above. Before, after, or during the .start() call, or somewhere else?
Please, look at my example one more time.
Done. It didn't really help looking at it a third time. It's still
unclear what you want.
Maybe explaining the use case would help you help us help you.
Your example seems contrived. In the real code you want to write, why
do you expect an exception to occur? Will it be raised deliberately, as
you show in the example, or is it unexpected (and unhandled by any
try/except at the top level of the thread's run() method)? Or do you
really need to use an exception here?
I'm quite sure the problem you are trying to solve can be solved, but
you are still describing part of the solution you believe you need,
rather than explaining why you want to do this (which may let us show
you other, simpler or cleaner ways to accomplish your goals).
-Peter