exit-codes

raw JSON →
1.3.0 verified Mon Apr 27 auth: no python

Platform-independent exit codes for Python. Provides a comprehensive mapping of standardized exit codes (e.g., EX_OK, EX_USAGE, EX_SOFTWARE) based on POSIX and common system conventions. Current version 1.3.0; stable with infrequent releases.

pip install exit-codes
error ModuleNotFoundError: No module named 'exit-codes'
cause Trying to import using the PyPI name with hyphen instead of underscore.
fix
Use import exit_codes (with underscore).
error AttributeError: module 'exit_codes' has no attribute 'EX_OK'
cause Perhaps the library is not installed or an older version without that constant.
fix
Run pip install --upgrade exit-codes and check the installed version.
gotcha The library does not provide reverse lookups (e.g., getting name from code). All exit codes are integer constants.
fix If you need reverse lookup, maintain your own mapping.
gotcha The module name uses a hyphen in PyPI but an underscore in Python: `import exit_codes` (not `exit-codes`).
fix Use `import exit_codes` in code.
deprecated Some constants like EX_TEMPFAIL are defined but may be platform-specific and not always available.
fix Check if the constant exists before using via `hasattr(exit_codes, 'EX_TEMPFAIL')`.

Use exit codes from the module for platform-independent script exits.

import sys
import exit_codes

sys.exit(exit_codes.EX_USAGE)  # exits with code 64