如何使脚本的返回值为0

时间:2012-01-29 17:59:34

标签: python

我有一个触发另一个脚本的脚本:

exit_status = subprocess.call([RUN_SCRIPT)]
if exit_status: # if successful output
    # do something
else: # if script is not successful
    # send email to admins

# RUN_SCRIPT
if return_value < error_threshold:
    # return exit status = 1
if return_value > error_threshold:
    # return exit status = 0

我该怎么做?

1 个答案:

答案 0 :(得分:7)

http://docs.python.org/library/sys.html

sys.exit(0)/ sys.exit(1)