The difference between sys.exit (1) and sys.exit (2) of python

if not cmdname:

    _print_commands(settings, inproject)
    sys.exit(0)

elif cmdname not in cmds:

    _print_unknown_command(settings, cmdname, inproject)
    sys.exit(2)
    

the difference between sys.exit (2) and sys.exit (1) here
I don"t know why.

Mar.07,2022

sys.exit ([args]) Parameter parsing

The optional argument arg can be an integer giving the exit status (defaulting to zero), or another type of object. If it is an integer, zero is considered "successful termination" and any nonzero value is considered "abnormal termination" by shells and the like.

means that when the parameter is a number, the meaning of the shell exit code is the same as that of the sys.exit (2) and sys.exit (1) just to distinguish the end reason

.
  • 0 : end successfully
  • 1 : general error
  • 2 : misuse the Shell command
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ee58-4daea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ee58-4daea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?