exitstatus
raw JSON → 2.7.0 verified Fri May 01 auth: no python
A Python library that provides named constants for POSIX exit status codes (e.g., EX_OK, EX_USAGE, EX_SOFTWARE). Current version 2.7.0, requires Python >=3.10. Release cadence is roughly once per year, following Python version support.
pip install exitstatus Common errors
error ImportError: cannot import name 'EX_OK' from 'exitstatus' ↓
cause Direct import of EX_* constants was removed in v2.0.0.
fix
Use 'from exitstatus import ExitStatus' and access ExitStatus.success.
error AttributeError: module 'exitstatus' has no attribute 'EX_OK' ↓
cause Trying to access EX_OK directly on the module after importing exitstatus.
fix
Use 'from exitstatus import ExitStatus' and then ExitStatus.success.
Warnings
breaking In v2.0.0, the library was rewritten to use an IntEnum; direct imports of EX_* constants (like 'from exitstatus import EX_OK') no longer work. ↓
fix Use 'from exitstatus import ExitStatus' and reference ExitStatus.success etc.
deprecated Python 3.9 and earlier are no longer supported as of v2.7.0. ↓
fix Upgrade Python to 3.10+ or use exitstatus <=2.6.0.
gotcha ExitStatus enum values are integers, but they are not compatible with plain int in some strict type checkers if you compare using 'is' instead of '=='. Always compare with '=='. ↓
fix Use 'sys.exit(ExitStatus.success) == 0' or 'if code == ExitStatus.success:'.
Imports
- ExitStatus
from exitstatus import ExitStatus - EX_OK wrong
from exitstatus import EX_OKcorrectfrom exitstatus import ExitStatus exit_code = ExitStatus.success
Quickstart
import sys
from exitstatus import ExitStatus
sys.exit(ExitStatus.success) # exit code 0
# sys.exit(ExitStatus.failure) # exit code 1
# sys.exit(ExitStatus.usage) # exit code 64