PyDocs

Nav

Debugging and profiling

run

pdb

function (source)
  • run(statement, globals=None, locals=None)
Execute the *statement* (given as a string or a code object)
under debugger control.

The debugger prompt appears before any code is executed; you can set
breakpoints and type continue, or you can step through the statement
using step or next.

The optional *globals* and *locals* arguments specify the
environment in which the code is executed; by default the
dictionary of the module __main__ is used (see the explanation of
the built-in exec() or eval() functions.).
1 Example
>>> import pdb
>>> def f(x):
...     print(1 / x)
>>> pdb.run("f(2)")
> <string>(1)<module>()
(Pdb) continue
0.5
>>>
from the Python docs
See Also
No see-alsos for pdb/run
0 Notes
No notes for run