Debugger and Profiler
Pdb is an interactive Python source-code debugger available as a standard library module.
Loads debugger interface (a module written in Python).
pdb.run(string [,globals [,locals]])
Runs code string string in the debugger. The string is assumed to contain a Python statement and runs in module __main__ by default unless globals and/or locals namespace dictionaries are passed.
pdb.runeval(string [,globals [,locals]])
pbd.run,but assumes string contains an expression (not a statement) and returns its result.
pdb.runcall(func, arg1, arg2, . . . )
Runs a call to function object func with the listed arguments (in the debugger). Returns func result.
Runs postmortem session on the last exception that occurred (much like debugging a core file).
Runs a postmortem session on traceback object tb.
A customizable debugger class which retains state between operations (e.g., break points).
The debugger runs program until breakpoint reached, exception raised, or end of program, but it also stops initially so you can set break points and continue.
In run, string can be any Python statement, in the form of a Python string: pdb.run(“x = main(‘spam’)”).
To debug script files, import them, optionally setting sys.argv first: pdb.run(“import file”). Can also run scripts under debugger with a command line like: “python libpath/pdb.py myscript.py.”
Each command name has a short (h) and long (help) ...