← All notes

Python errno: standard system error symbols and the errorcode map

Answer: The errno module makes available standard errno system symbols. errorcode provides a mapping from the errno value to the string name.

Symbols and the errorcode dictionary

Each symbol's value is the matching integer used by the underlying system.

Symbol names and descriptions are borrowed from linux/include/errno.h and are treated as all-inclusive.

errorcode is a dictionary that maps a numeric errno value to the string name on that system.

For example, errno.errorcode[errno.EPERM] maps to the name EPERM.

os.strerror translates a numeric error code into an error message.

Platform-defined symbols and exception mapping

Symbols that the current platform does not use are not defined by the module.

The defined names are the keys of errno.errorcode.

EPERM is mapped to the exception PermissionError.

ENOENT is mapped to the exception FileNotFoundError.

EIO is an I/O error.

ENOMEM is out of memory.

EINVAL is described as an invalid argument.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, errno — Standard errno system symbols; CPython, errno documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, errno — Standard errno system symbols; CPython, errno documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.

Cite this

Permanent ID: iil:note:4e85e2re

iinventedlight. 2026. "Python errno: standard system error symbols and the errorcode map." iinventedlight Library, iil:note:4e85e2re, version of 2026-11-27. https://iinventedlight.com/library/notes/python-errno/. License: CC-BY-4.0.

@misc{iil_note_4e85e2re,
  author = {{iinventedlight}},
  title = {{Python errno: standard system error symbols and the errorcode map}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-27},
  url = {https://iinventedlight.com/library/notes/python-errno/},
  note = {Permanent ID iil:note:4e85e2re. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-errno.md.