How can I return a non-zero status result from a python script?

Rob Williscroft rtw at freenet.co.uk
Mon Dec 15 16:35:17 EST 2008


silverburgh.meryl at gmail.com wrote in news:74b53da4-bf07-431b-898b-
49977f7a685c at r36g2000prf.googlegroups.com in comp.lang.python:

> Hi
> 
> How can I return a non-zero status result from the script? Just do a
> return 1? at the end?
> 

>>> import sys
>>> help( sys.exit )
Help on built-in function exit in module sys:

exit(...)
    exit([status])

    Exit the interpreter by raising SystemExit(status).
    If the status is omitted or None, it defaults to zero (i.e., success).
    If the status is 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).

>>>

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list