Python exit codes

后端 未结 4 1035
失恋的感觉
失恋的感觉 2021-02-18 22:11

Where can I find information about meaning of exit codes of \"python\" process on Unix? For instance, if I do \"python thisfiledoesntexist.py\", I get exit code 2

Summar

4条回答
  •  感动是毒
    2021-02-18 22:58

    As stated, mostly the error codes come from the executed script and sys.exit().

    The example with a non-existing file as an argument to the interpreter fall in a different category. Though it's stated nowhere I would guess, that these exit codes are the "standard" Linux error codes. There is a module called errno that provides these error numbers (the exit codes come from linux/include/errno.h.

    I.e.: errno.ENOENT (stands for for "No such file or directory") has the number 2 which coincides with your example.

提交回复
热议问题