Skip to main content

ignore_errno

Context manager to ignore specific POSIX error codes.

def ignore_errno(
*errnos: Union[str, int],
types: Tuple[Exception]
) - > contextmanager

Context manager to ignore specific POSIX error codes.

Parameters

NameTypeDescription
*errnosUnion[str, int]A list of error codes to ignore, provided as either the string name (e.g., 'ENOENT') or the integer code.
typesTuple[Exception]A tuple of exception classes to catch and inspect for matching errnos; defaults to Exception.

Returns

TypeDescription
contextmanagerA context manager that suppresses exceptions with matching POSIX error codes.