I want to utilize introspection capability of python for debugging/development, but cannot find appropriate tool for this.
I need to enter into shell (IPython for example) at specific position or at specific event (like exception), with locals and globals of shell being set to the frame's ones.
My own quick hack to illustrate it:
import inspect
from IPython.Shell import IPShellEmbed
def run_debug():
stack = inspect.stack()
frame = stack[1][0]
loc = frame.f_locals
glob = frame.f_globals
shell = IPShellEmbed()
shell(local_ns=loc, global_ns=glob)
With according run_debug() call from 'breakpoint' or try/except. But, obviously, this needs alot of polishing, esp to work with threaded apps properly.
winpdb has breakpoints with console, but I found no way to quickly run proper python shell from it, and eval()/exec() are not very handy for long debug.