Thanks for your answer, Steve. I try to do this, when possible. But I
often run into situations where I am instantiating classes and running
methods from the interactive prompt. The problem occurs if I would
like to enable a breakpoint, e.g. in one of the instance methods, in
the middle of the interactive session (as I am used to doing in
MATLAB, for example.)

Spyder will not stop on my breakpoint unless I create a new script
with just a single statement in it and run it in the current
interpreter with Ctrl-F5. Another possibility is to invoke the post
mortem debugger by running an illegal statement, as I described in my
posting. A more intuitive way of doing this would have been nice :)

Regards,
-Øystein

On Mar 5, 6:59 pm, Steve <[email protected]> wrote:
> Øystein,
>
> You should try the built in spyder debugger.  If you run your script
> using Ctrl+F5, this will execute using pdb and should stop at your
> breakpoints.
>
> -Steve
>
> On Mar 3, 2:24 pm, edge77 <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hello. I am wondering how I can make Spyder stop on a breakpoint
> > inside a function during an interactive session.
>
> > Say, I have a function testfun:
>
> > def testfun():
> >    print 'line1'
> >    print 'line2' #breakpoint
> >    print 'line3'
>
> > Then I set a breakpoint on line 2 (by pressing F12 on this line). I
> > would like to be able to run this function from the IPython console
> > and make it stop on the breakpoint.
>
> > I found out that if I write:
>
> > > pdb
>
> > Automatic pdb calling has been turned ON
>
> > followed by an illegal statement such as 'spam', the debugger will be
> > opened, and I can write "debug testfun()" to do that I want:
>
> > spam
> > ------------------------------------------------------------
> > Traceback (most recent call last):
> >   File "<ipython console>", line 1, in <module>
> > NameError: name 'spam' is not defined
>
> > > <ipython console>(1)<module>()
>
> > ipdb> debug testfun()
>
> > But is there any easier or "more elegant" way of doing this?
>
> > Cheers,
> > Øystein

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/spyderlib?hl=en.

Reply via email to