[IPython-User] replacing pdb with ipython 0.12

Robert Cimrman cimrman3@ntc.zcu...
Thu Jan 19 09:43:51 CST 2012


On 01/19/12 14:51, Lev Givon wrote:
> 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

Thanks! That should get me started, although I do not want another dependency.

r.


More information about the IPython-User mailing list