I don't think I've quite got it. The application I'm writing has some similarities to an interactive shell. Like an interactive shell, it executes arbitrary code that it receives from an input stream. When it gets an exception, it should create an informative message, regardless of the type of exception. The traceback routine does that, somehow, some way, but I've tried to read that code and figure out how and I don't get it.
The best I have so far is, class Exec_thread(BG_thread): """ Execute a line of code in the global namespace. """ def _process(s): """ Process one instruction """ try: exec s.product in globals() except (Exception), e: handle_error( typename(e)+ ": " + str(e) ) But that works only if the exception happens to be derived from Exception. How do I handle the general case? -- http://mail.python.org/mailman/listinfo/python-list