Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197559

Re: Drop into REPL when your program crashes.

Path csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Ethan Carter <ec1828@somewhere.edu>
Newsgroups comp.lang.python
Subject Re: Drop into REPL when your program crashes.
Date Mon, 08 Sep 2025 21:21:20 -0300
Organization A noiseless patient Spider
Lines 20
Message-ID <87ikhslblr.fsf@somewhere.edu> (permalink)
References <7a0dbcc10639dce0c40a6c4b3972f19bde2fc14e.camel@tilde.green>
MIME-Version 1.0
Content-Type text/plain
Injection-Date Tue, 09 Sep 2025 00:21:20 +0000 (UTC)
Injection-Info dont-email.me; posting-host="832ef7ce292733f64f11afa466facb1c"; logging-data="675544"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19j6iIDkpWVAINkMsubv/6wobpXPZB0W/Q="
Cancel-Lock sha1:Zv2WQlnffcRUjxRDSOcZEV3HYUY= sha1:k5c6vfW333AB+UqFomz/x1A9JM8=
Xref csiph.com comp.lang.python:197559

Show key headers only | View raw


Annada Behera <annada@tilde.green> 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! :>

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar


Thread

Drop into REPL when your program crashes. Annada Behera <annada@tilde.green> - 2025-09-08 16:37 +0530
  Re: Drop into REPL when your program crashes. ram@zedat.fu-berlin.de (Stefan Ram) - 2025-09-08 12:34 +0000
    Re: Drop into REPL when your program crashes. Annada Behera <annada@tilde.green> - 2025-09-09 11:53 +0530
  Re: Drop into REPL when your program crashes. Ethan Carter <ec1828@somewhere.edu> - 2025-09-08 21:21 -0300

csiph-web