continue out of a loop in pdb

Gary Wessle phddas at yahoo.com
Sun May 14 16:33:55 EDT 2006


"Paul McGuire" <ptmcg at austin.rr._bogus_.com> writes:

> "Gary Wessle" <phddas at yahoo.com> wrote in message
> news:87mzdkwke3.fsf at localhost.localdomain...
> > Hi
> >
> > using the debugger, I happen to be on a line inside a loop, after
> > looping few times with "n" and wanting to get out of the loop to the
> > next line, I set a break point on a line after the loop structure and
> > hit c, that does not continue out of the loop and stop at the break
> > line, how is it down, I read the ref docs on pdb but could not figure
> > it out.
> >
> > thanks
> 
> This is exactly how I do this operation using pdb, and it works for me, so
> you are on the right track.  Is it possible that something inside the loop
> is raising an exception, thereby jumping past your breakpoint? Try putting
> the loop inside a try-except.
> 
> -- Paul

the code works with no problem, I am playing around with the pdb, i.e

****************
from pdb import *
set_trace() 

for i in range(1,500000):
    print i
print "tired of this"
print "I am out"
****************

fred at debian:~/python/practic$ python practic.py 
> /home/fred/python/practic/practic.py(4)?()
-> for i in range(1,500000):
(Pdb) n
> /home/fred/python/practic/practic.py(5)?()
-> print i
(Pdb) n
1
> /home/fred/python/practic/practic.py(4)?()
-> for i in range(1,500000):
(Pdb) b 6
Breakpoint 1 at /home/fred/python/practic/practic.py:6
(Pdb) c
> /home/fred/python/practic/practic.py(5)?()
-> print i <<<< I expected (print "tired of this")
(Pdb) 



More information about the Python-list mailing list