[Tutor] Use flag to exit?

Alan Gauld alan.gauld at btinternet.com
Fri Jun 25 02:06:08 CEST 2010


"Richard D. Moores" <rdmoores at gmail.com> wrote

> I think I much prefer accomplishing an exit by a function return, as 
> I
> do in <http://tutoree7.pastebin.com/QtAAtATd>, but if I wanted to 
> use
> sys.exit() in a script (but not in a function) I run inside IDLE or
> Wing, how do I suppress the message? I'd just like to get that 
> nailed
> down.

You can catch it like any other exception but that's not really the 
point.
IDLE is not intended to run programs it's for developing them. It is 
set
up to catch keyboard interrupts and sys exits deliberately because
that's what you want in a development tool. Just run the programs
outside IDLE and they won't get caught and you won't get error
messages.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list