What does sys.exit(1) means?

Tim Hammerquist tim at vegeta.ath.cx
Sun Jun 2 01:54:15 EDT 2002

Ken graced us by uttering:
> What does sys.exit(1) means?

Simply, shut down the current (Python) process and return a status of 1
to the shell.

But from the Python docstrings:

$ python
Python 2.2 (#1, Jan 17 2002, 22:02:17)
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.exit.__doc__

Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).

Tim Hammerquist
"Did someone open up your skull and carefully
replace your brain with rat droppings?   [Say yes!]"
    -- Tom Servo, MST3K

More information about the Python-list mailing list