On this page
shutil.Error
Prev: shutil.disk_usage | Up: shutil | Next: shutil.get_archive_formats
Rel: shutil.chown, shutil.copy, shutil.copy2, shutil.copyfile
Ref: docs.python.org โ shutil.Error
Tags: #public #python3 #stdlib #shutil
Import
import shutil
from shutil import Error
Signature & Overview
shutil.Error(...)
shutil.Error class.
Methods & Attributes
Error.add_note(self, note, /)โ Add a note to the exceptionError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import shutil
# Base exception for multi-file operations like copytree()
assert issubclass(shutil.Error, OSError)
assert issubclass(shutil.SameFileError, shutil.Error)
Gotchas
copytree()collects per-file failures intoexc.args[0]: Each element is a(src, dst, error_message)tuple rather than stopping at the first file.- Single-file calls raise standard
OSError: Don't expectshutil.Errorto catchFileNotFoundErrororPermissionError.
REPL Inspect
from shutil import Error
help(Error)
Linked from
Related notes
- tuts/python3/stdlib_module/shutil/disk_usage Linked here; links to this page; shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/get_archive_formats Linked here; links to this page; shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/shutil/chown Linked here; shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/copy Linked here; shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/copy2 Linked here; shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/copyfile Linked here; shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/copyfileobj shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/copymode shared tags: #shutil, #stdlib
- tuts/python3/stdlib_module/shutil/copystat shared tags: #shutil, #stdlib