Re: Drop into REPL when your program crashes.

Ethan Carter <[email protected]>
Newsgroups gmane.comp.python.general
Organization A noiseless patient Spider
Message-ID <[email protected]>
Annada Behera <[email protected]> writes:

> Hi,
>
> Recently I have been increasingly adding this piece of code as
> a preamble to a lot of my code.
>
>     import (sys, os, ipdb)
>
>     def debug_hook(exc_type, exc_value, traceback):
>         if exc_type is KeyboardInterrupt:
>             sys.__excepthook__(exc_type, exc_value, traceback)
>             return
>         print(f"Uncaught exception: {exc_type.__name__}: {exc_value}")
>         ipdb.post_mortem(traceback)
>
>     if os.environ.get('DEBUG'): sys.excepthook = debug_hook

Pretty nice contribution!  I had no idea such thing was possible with
Python.  The more Common Lispy it gets, the better it feels! :>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.