[IPython-User] replacing pdb with ipython 0.12
Lev Givon
lev@columbia....
Thu Jan 19 07:51:16 CST 2012
Received from Robert Cimrman on Thu, Jan 19, 2012 at 05:18:03AM EST:
> Hi!
>
> Up to ipython 0.10.2, I have used the following code
>
> import sys
> old_excepthook = sys.excepthook
>
> from IPython.Debugger import Pdb
> from IPython.Shell import IPShell
> from IPython import ipapi
>
> def debug():
> shell = IPShell(argv=[''])
> sys.excepthook = old_excepthook
> ip = ipapi.get()
> def_colors = ip.options.colors
> Pdb(def_colors).set_trace(sys._getframe().f_back)
>
> to replace pdb.set_trace() call - instead I call debug() and get ipython prompt
> at the corresponding line of the code, with colors, tab-completion etc.
>
> How to upgrade the code for >= 0.11?
>
> r.
The following works with 0.11+:
http://pypi.python.org/pypi/ipdb
L.G.
More information about the IPython-User
mailing list