Interactive debugging

Diez B. Roggisch deets at nospam.web.de
Mon Jun 26 04:50:19 EDT 2006


63q2o4i02 at sneakemail.com wrote:

> Hi, is there a way in python to place some sort of keyboard() type
> statement which stops the script and puts you back at the console?  I'm
> looking for something like in matlab, where you place a keyboard()
> command (I think), then you're in debug mode in the console, and you
> type continue to re-enter the script where you left off.  While you're
> in the debugger/console you're at the scope where the keyboard() call
> was and you can manipulate variables, etc.  Is there something like
> this in python?  I've been using winpdb, which is great, but sometimes
> I need more interactivity.  Is this what pdb is about?

Use

import pdb
pdb.set_trace()

The line where the set_trace() is invoked puts you back in the interpreter.

Diez



More information about the Python-list mailing list