all Python 3Exceptionsexception
shutil.SpecialFileError
module exceptions
An operation hit a special file (a socket or device) that cannot be copied like a regular one.
Syntax
raise shutil.SpecialFileError
copyfile only screens for named pipes (FIFOs); sockets and device files are not checked, so copying something like /dev/zero will happily read forever. The class derives from OSError rather than shutil.Error, which means an except shutil.Error clause misses it. On Windows you will essentially never see it, since FIFOs are not filesystem objects there.
Examples
import shutil
try:
raise shutil.SpecialFileError
except shutil.SpecialFileError as e:
print(type(e).__name__) # → SpecialFileError
See also
Open in the full glossarydocs.python.orgReport an inaccuracy