incompatible exit values between python 2.4 and 2.5

Diez B. Roggisch deets at nospam.web.de
Mon Sep 18 11:23:16 CEST 2006


> 1) is this change of behaviour documented somewhere and did I miss
> that, or has this not been documented (yet)
> 2) Is there a build-in way to set the exit value for Python in case an
> exception is raised that is uncaught and causes python to terminate? (I
> have now implemented something using
>    try:
>       ...
>    except ImportError, comment:
>       sys.exit(2)
>    except:
>       sys.exit(1)
> but I still have to figure out how to print the stacktrace before
> exiting with specific values.)

For the latter, take a look at

sys.exc_info()


Diez



More information about the Python-list mailing list