You are viewing an older version (9.3.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.3.0 / IPython / core / magics / execution / ExecutionMagics / debug

function

IPython.core.magics.execution:ExecutionMagics.debug

source: /IPython/core/magics/execution.py :437

Signature

def   debug ( self line = '' cell = None local_ns = None )

Summary

::

Extended Summary

%debug [--breakpoint FILE:LINE] [statement ...]

Activate the interactive debugger.

This magic command support two ways of activating debugger. One is to activate debugger before executing code. This way, you can set a break point, to step through the code from the point. You can use this mode by giving statements to execute and optionally a breakpoint.

The other one is to activate debugger in post-mortem mode. You can activate this mode simply running %debug without any argument. If an exception has just occurred, this lets you inspect its stack frames interactively. Note that this will always work only on the last traceback that occurred, so you must call this quickly after an exception that you wish to inspect has fired, because if another one occurs, it clobbers the previous one.

If you want IPython to automatically do this on every exception, see the %pdb magic for more details.

positional arguments:

statement Code to run in debugger. You can omit this in cell magic mode.

options:

--breakpoint <FILE:LINE>, -b <FILE:LINE>

Set break point at LINE in FILE.

Aliases

  • IPython.core.magics.ExecutionMagics.debug