A cross-operating-system compatible library for os.EX_* constants
Project description
Exit Codes
This package is a cross-operating-system compatible version of the os
library's EX_* constants.
If these constants are available, they will be re-exported directly from os
, otherwise the integer version will be provided from this library.
This library also provides an enum version of the exit codes, if that is of value.
Apologies for the weird PyPi name, they're a bit overly restrictive and don't point to what specifically is the conflicting package.
Installation
python -m pip install -U os-exitcodes
Usage
Constants
from os_exitcodes import (
EX_OK,
EX_USAGE,
)
from random import choice
def is_valid_usage() -> bool:
# check if the user is using this properly
# for a working example, this is random
return choice([True, False])
def main() -> None:
invalid_usage = random
if not is_valid_usage():
raise SystemExit(EX_USAGE)
raise SystemExit(EX_OK)
if __name__ == "__main__":
main()
Enumeration
from os_exitcodes import ExitCode
from random import choice
def is_valid_usage() -> bool:
# check if the user is using this properly
# for a working example, this is random
return choice([True, False])
def main() -> None:
invalid_usage = random
if not is_valid_usage():
raise SystemExit(ExitCode.EX_USAGE)
raise SystemExit(ExitCode.EX_OK)
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
os_exitcodes-1.0.1.tar.gz
(4.7 kB
view details)
Built Distribution
File details
Details for the file os_exitcodes-1.0.1.tar.gz
.
File metadata
- Download URL: os_exitcodes-1.0.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.6 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b3c8dcd1acf4fc0f1549b7259d0071e0f7d0bfc3d9e0754a49b884d80f2e32e |
|
MD5 | 257f3787b52bf0cb7ab049e32a4a5fef |
|
BLAKE2b-256 | 6d8bec0199561ff560b219742e235b7caec76b7aa21f571f5b6892732e9e30bd |
File details
Details for the file os_exitcodes-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: os_exitcodes-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.14 CPython/3.10.6 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 959398824a4e15d019a4bebd1404f4801c311ddfc67fc1a8561a1d4dcc6a79ff |
|
MD5 | f46afcd7218d2a4b4d3281d3cd56c5ee |
|
BLAKE2b-256 | 7fdea3ff60f849f298353275b69e85fa07bf908c145f08409366c96df85bda1e |