Skip to main content
100%

Launch ipdb only on Exception

✓ Published0🌍 Public
WWilliamQLiu
Last edited Apr 25, 2018
Created on Apr 25, 2018

This example demonstrates how to automatically launch an interactive debugger at the exact point where an exception occurs, rather than after the program terminates. It uses the `slaunch_ipdb_on_exception` context manager from the `ipdb` library, which wraps a block of code and intercepts any raised exception. When an error is triggered, the context manager drops the user into an IPython debugger session with access to the local stack frames and variables. The code shows a minimal usage pattern: importing the context manager and wrapping a single `with` block, making it clear how to integrate debugging into existing Python workflows.

AI-generated description

Similar vizzes