errno — system error codes#

This module provides access to symbolic error codes for the OSError exception, along with the errorcode dictionary mapping numeric codes back to their symbolic names.

Constants#

The error codes below are based on the ANSI C / POSIX standard; each is an integer whose symbolic name starts with E. These are the codes provided on the OpenMV Cam. An error code is usually accessed 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.EPERM: int#

Operation not permitted.

errno.ENOENT: int#

No such file or directory.

errno.EIO: int#

I/O error.

errno.EBADF: int#

Bad file descriptor.

errno.EAGAIN: int#

Resource temporarily unavailable. Returned by a non-blocking operation (e.g. a socket read/write) that would otherwise block.

errno.ENOMEM: int#

Out of memory.

errno.EACCES: int#

Permission denied.

errno.EEXIST: int#

File or directory already exists.

errno.ENODEV: int#

No such device.

errno.EISDIR: int#

Is a directory (an operation that requires a file was applied to a directory).

errno.EINVAL: int#

Invalid argument.

errno.EOPNOTSUPP: int#

Operation not supported on the socket or device.

errno.EADDRINUSE: int#

Address already in use.

errno.ECONNABORTED: int#

Connection aborted.

errno.ECONNRESET: int#

Connection reset by peer.

errno.ENOBUFS: int#

No buffer space available.

errno.ENOTCONN: int#

Socket is not connected.

errno.ETIMEDOUT: int#

Connection or operation timed out.

errno.ECONNREFUSED: int#

Connection refused.

errno.EHOSTUNREACH: int#

Host is unreachable (no route to host).

errno.EALREADY: int#

Operation already in progress.

errno.EINPROGRESS: int#

Operation now in progress (e.g. a non-blocking connect()).

errno.errorcode: dict[int, str]#

Dictionary mapping each numeric error code to a string with its symbolic name:

>>> print(errno.errorcode[errno.EEXIST])
EEXIST