[SciPy-user] ipython: debug with breakpoint in subfunction?

Steve Schmerler elcorto@gmx....
Thu Sep 20 15:08:21 CDT 2007

Jose Unpingco wrote:
> I am running the Enthought windows XP tool suite and am using ipython 0.7.2.
> I know I can do %run -d -b11 func.py
> to set a breakpoint at line 11 and run func.py in ipython. However, I call a number of sub-functions from func.py that reside in other files.
> How can I set a breakpoint for a sub-function in another file using ipython?

This might work: suppose main.py, in which sub.py is imported:

In [6]: %run -d main.py
Breakpoint 1 at /home/elcorto/tmp/main.py:1
NOTE: Enter 'c' at the ipdb>  prompt to start your script.
> <string>(1)

ipdb> b sub.func
Breakpoint 2 at /home/elcorto/tmp/sub.py:4
ipdb> c
> /home/elcorto/tmp/main.py(1)
1---> 1 print 'hoho+++'
      2 import sub
      3 sub.func2()

ipdb> <ENTER>
> /home/elcorto/tmp/sub.py(5)func()
2     4 def func():
----> 5     a = 1
      6     b = 2

ipdb> <ENTER>

In [7]:


I love deadlines. I like the whooshing sound they make as they fly by. --
Douglas Adams

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.py
Type: text/x-python
Size: 50 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20070920/6ec381fd/attachment.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sub.py
Type: text/x-python
Size: 87 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20070920/6ec381fd/attachment-0001.py 

More information about the SciPy-user mailing list