Python 3.4+statfunction
stat.S_ISDOOR()
file type
Checks from st_mode that the object is a door, a special IPC object that exists only on Solaris.
Syntax
stat.S_ISDOOR(os.stat(path).st_mode)
The function exists on every system since Python 3.4, so code using it is portable, but outside Solaris it always returns False: the stat.S_IFDOOR constant is 0 on Linux, macOS and Windows. So the test `mode & stat.S_IFDOOR` is always false there as well; use the function, not the constant.
Examples
import os, stat
open('f.txt', 'w').close()
print(stat.S_ISDOOR(os.stat('f.txt').st_mode)) # → False
print(stat.S_IFDOOR) # → 0 (на Linux, macOS и Windows)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy