how do I exit gracefully?

Andrew Pierce NospaMapierce at escapeNospaM.com
Sun Oct 29 11:55:46 EST 2000


in article mailman.972837503.8498.python-list at python.org, Thomas Wouters at
thomas at xs4all.net wrote on 10/29/00 11:36 AM:
> Actually, sys.exit() does raise an exception, but that's besides the point
> ;) My bet is the exception the original guy was talking about was
> 'NameError'. He probably forgot to import sys and/or os before using them.

Uh no.  I did remember to import sys and/or os. :)  The point is I didn't
want to clutter error logs with sys.exit() calls.  The solution of:

try:
    main()
except SystemExit:
    #we're ok
except:
    #error processing here

Looks good to me.  I still don't know what (if anything) python does at the
"normal" program termination of running out of instructions to execute. :/
     -Andy





More information about the Python-list mailing list