errno – system error codes — Adafruit CircuitPython 1 documentation (original) (raw)
This module implements a subset of the corresponding CPython module, as described below. For more information, refer to the original CPython documentation: errno.
This module provides access to symbolic error codes for OSError exception. Some codes are not available on the smallest CircuitPython builds, such as SAMD21, for space reasons.
Constants
EEXIST, EAGAIN, etc.
Error codes, based on ANSI C/POSIX standard. All error codes start with “E”. Errors are usually accessible as exc.errno
where exc
is an instance of OSError. Usage example:
try: os.mkdir("my_dir") except OSError as exc: if exc.errno == errno.EEXIST: print("Directory already exists")
errno.errorcode
Dictionary mapping numeric error codes to strings with symbolic error code (see above):
print(errno.errorcode[errno.EEXIST]) EEXIST