stop script w/o exiting interpreter

Miki miki.tebeka at gmail.com
Thu Jan 25 20:44:25 EST 2007


Hello Alan,

> I'm fairly new to Python and I've lately been running a script at
> the interpreter while working on it.  Sometimes I only want to
> run the first quarter or half etc.  What is the "good" way to do this?
If you want to exit from the program then "raise SystemExit" is what
you want.
If you want to enter the debugger, you can do:

from pdb import set_trace

...
set_trace() # Stop and execute debugger here.
...

HTH,
--
Miki
http://pythonwise.blogspot.com




More information about the Python-list mailing list