aborting without killing the python interpreter

Fabrizio Milo mistobaan at gmail.com
Sun Feb 19 05:01:57 EST 2006


import sys

def main():
    print 'exiting'
    sys.exit()

try:
   main()
except SystemExit:
   pass


> I suspect I may need to use exceptions, but I'm hoping
> not to need them. Thanks.

Use the Exceptions!



More information about the Python-list mailing list