Skip to content

Python Linux Exit Codes

Python Linux Exit Codes#

If a program exits with a non-zero code - it was not successful

Sometimes you need to create scripts that give an exit status code to the calling program. Here is some info with exit codes with special meaning

At it’s code:

  • 0 - means successful
  • 1 - 255 - means failure / error

In python that is done using sys.exit():

import sys
# fail
sys.exit(1)