When I give Python's argparse input it doesn't like, it raises a SystemExit with a code of 2, which seems to mean "No such file or directory". Why use this error code?
import argparse
import errno
parser = argparse.ArgumentParser()
parser.add_argument('arg')
try:
parser.parse_args([])
except SystemExit as se:
print("Got error code {} which is {} in errno"
.format(se.code, errno.errorcode[se.code]))
produces this output:
usage: se.py [-h] arg
se.py: error: too few arguments
Got error code 2 which is ENOENT in errno