stop script w/o exiting interpreter

Gabriel Genellina gagsl-py at yahoo.com.ar
Sat Jan 27 20:13:15 EST 2007


"Alan Isaac" <aisaac at american.edu> escribió en el mensaje 
news:wWQuh.1259$SE6.1215 at trnddc03...

> Please note that this post has subject
> "stop script w/o exiting interpreter".
> Note that I can just put the undefined name ``stop`` on any line
> I want, and the script will stop execucting at that line and will
> return to the interactive interpreter, as I wish.  It is just that it
> returns with an error message, and I'd like to avoid that.

If this is just for playing inside the interpreter, just ignore the 
exception.
Or comment out all lines from 25 to end of script, some editors (including 
IDLE) have support for that.
Or use a giant """
string
""" if you can.
If you invoke your script with `python -i your_script.py` Python will show 
the interpreter prompt when your script finishes (either normally or raising 
an exception).

-- 
Gabriel Genellina





More information about the Python-list mailing list