incompatible exit values between python 2.4 and 2.5

John Machin sjmachin at lexicon.net
Mon Sep 18 07:51:18 EDT 2006


Diez B. Roggisch wrote:
> > 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()
> 

 or perhaps the traceback module ...

Cheers,
John




More information about the Python-list mailing list