The errno
module defines a number of symbolic error codes, such as
ENOENT
(“no such directory entry”) and
EPERM
(“permission denied”). It also provides a dictionary mapping from platform-dependent
numerical error codes to symbolic names. Example 2-21 shows how to use errno
.
In most cases, the IOError
exception provides a
2-tuple with the numerical error code and an explanatory string. If
you need to distinguish between different error codes, use the
symbolic names where possible.
Example 2-22 is a bit contrived, but it shows how to use the
errorcode
dictionary to map from a numerical error
code to the symbolic name.
3.14.144.229