How do you exit python during execution of script?

H. P. Friedrichs " HPeter.Friedrichs" at alliedsignal.com
Mon Sep 13 18:11:21 EDT 1999


Why does this generate an exception?

import sys
try:
    print "normal operation"
    sys.exit()        # I want to leave the script here
except:
    print "something went wrong"
    sys.exit()        # instead, I dump out here...why?

#...script continues here....
#.....
#....
Aahz Maruch wrote:

> In article <37DD64AE.2CCA341 at alliedsignal.com>,
> H. P. Friedrichs <HPeter.Friedrichs at alliedsignal.com> wrote:
> >
> >Is 'exit' an option? If so, how do you use it?
>
> import sys
> sys.exit()
> --
>                       --- Aahz (@netcom.com)
>
> Androgynous poly kinky vanilla queer het    <*>      http://www.rahul.net/aahz/
> Hugs and backrubs -- I break Rule 6  (if you want to know, do some research)

--

-----------------------------------------------
| The opinions expressed here are my own,     |
| and not necessarily those of my employer.   |
-----------------------------------------------






More information about the Python-list mailing list