continue out of a loop in pdb

Gary Wessle phddas at
Sun May 14 22:33:55 CEST 2006

"Paul McGuire" <ptmcg at> writes:

> "Gary Wessle" <phddas at> 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 *

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

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

More information about the Python-list mailing list