return values for exceptions

Martin v. Loewis martin at v.loewis.de
Mon Nov 18 18:32:09 EST 2002


"N. Thomas" <nthomas at cise.ufl.edu> writes:

> I suppose that I could trap the exception, and then return a value based on
> that, but I'm not too sure if that is the right way to go about doing it.

That is the right way. You can either use sys.exit, or raise
SystemExit, with the status you want to get out of Python. Returning 1
for an uncaught is hard-coded in Python.

Regards,
Martin




More information about the Python-list mailing list