Python errno Module
Example
Look up an error constant and its name:
import errno
print(errno.ENOENT)
print(errno.errorcode[errno.ENOENT])
Try it Yourself »
Definition and Usage
The errno module maps error numbers to symbolic names for OS-related errors.
Use it to compare exceptions like OSError against well-known constants and to format messages.
Members
| Member | Description |
|---|---|
| errorcode | Mapping from errno value to the symbolic name string. |
| ENOENT | Error constant for "No such file or directory". |
| EACCES | Error constant for "Permission denied". |
| EINVAL | Error constant for "Invalid argument". |
| EPERM | Error constant for "Operation not permitted". |
| EACCES | Permission denied. |
| EADDRINUSE | Address already in use. |
| EADDRNOTAVAIL | Cannot assign requested address. |
| EAFNOSUPPORT | Address family not supported by protocol. |
| EAGAIN | Resource temporarily unavailable (would block). |
| EALREADY | Operation already in progress. |
| EBADF | Bad file descriptor. |
| EBUSY | Device or resource busy. |
| ECHILD | No child processes. |
| ECONNABORTED | Software caused connection abort. |
| ECONNREFUSED | Connection refused. |
| ECONNRESET | Connection reset by peer. |
| EDEADLK | Resource deadlock avoided. |
| EDOM | Mathematics argument out of domain of function. |
| EEXIST | File exists. |
| EFAULT | Bad address. |
| EFBIG | File too large. |
| EHOSTUNREACH | No route to host. |
| EIDRM | Identifier removed. |
| EILSEQ | Illegal byte sequence. |
| EINPROGRESS | Operation now in progress. |
| EINTR | Interrupted system call. |
| EINVAL | Invalid argument. |
| EIO | Input/output error. |
| EISCONN | Transport endpoint is already connected. |
| EISDIR | Is a directory. |
| ELOOP | Too many levels of symbolic links. |
| EMFILE | Too many open files. |
| EMLINK | Too many links. |
| EMSGSIZE | Message too long. |
| ENAMETOOLONG | File name too long. |
| ENETDOWN | Network is down. |
| ENETRESET | Network dropped connection on reset. |
| ENETUNREACH | Network is unreachable. |
| ENFILE | Too many open files in system. |
| ENOBUFS | No buffer space available. |
| ENODEV | No such device. |
| ENOENT | No such file or directory. |
| ENOEXEC | Exec format error. |
| ENOLCK | No locks available. |
| ENOMEM | Cannot allocate memory. |
| ENOMSG | No message of desired type. |
| ENOPROTOOPT | Protocol not available. |
| ENOSPC | No space left on device. |
| ENOSYS | Function not implemented. |
| ENOTCONN | Transport endpoint is not connected. |
| ENOTDIR | Not a directory. |
| ENOTEMPTY | Directory not empty. |
| ENOTSOCK | Socket operation on non-socket. |
| ENOTTY | Inappropriate ioctl for device. |
| ENXIO | No such device or address. |
| EOPNOTSUPP | Operation not supported. |
| EPIPE | Broken pipe. |
| EPROTO | Protocol error. |
| EPROTONOSUPPORT | Protocol not supported. |
| EPROTOTYPE | Protocol wrong type for socket. |
| ERANGE | Result too large. |
| EROFS | Read-only file system. |
| ESPIPE | Illegal seek. |
| ESRCH | No such process. |
| ETIMEDOUT | Connection timed out. |
| ETXTBSY | Text file busy. |
| EWOULDBLOCK | Operation would block (alias of EAGAIN on many systems). |
| EXDEV | Invalid cross-device link. |