Python Glossary Русский

all Python 3until 3.16Exceptionsexception

shutil.ExecError

module exceptions

A deprecated shutil exception: no function in the module raises it; since 3.14 it emits DeprecationWarning, and 3.16 removes the name.

Syntax

raise shutil.ExecError

No function in shutil has raised this exception since Python 3.4. In Python 3.14 merely touching shutil.ExecError emits a DeprecationWarning and hands back plain RuntimeError (through 3.13 it was its own OSError subclass), and the name is scheduled for removal in 3.16. There is nothing worth catching here in new code.

Examples

# Python 3.14+
import shutil
try:
    raise shutil.ExecError
except RuntimeError as e:
    print(type(e).__name__)  # → RuntimeError — с 3.14 ExecError лишь псевдоним
# Python 3.16+
import shutil
print(hasattr(shutil, 'ExecError'))   # → False

See also

Open in the full glossarydocs.python.orgReport an inaccuracy