[Tutor] exit app withour raise ?

Dave S pythontut at pusspaws.net
Sun Sep 17 19:38:53 CEST 2006


On Sunday 17 September 2006 17:54, Alan Gauld wrote:
> > In the middle of an application, if someone presses the quit button
> > I want to
> > exit. At the moment i
> >
> > raise 'Quit button pressed'
> >
> > which works but spews a stack trace leading to the raise statement.
> > Is there a
> > neat way to just exit without a stack trace ?
>
> raise SystemExit
>
> or more commonly
>
> import sys
>
> sys.exit()
>
> You can add an argument to exit and that will be the error value
> returned
> to the OS.
>
> Alan G.

Thanks for that - it works great :)

Dave


More information about the Tutor mailing list