ID EN
Built-in Exceptions

NotADirectoryError

Python 3.11

Raised when a directory operation (such as os.listdir()) is requested on something which is not a directory. On most POSIX platforms, it may also be raised if an operation attempts to open or traverse a non-directory file as if it were a directory. Corresponds to errno ENOTDIR.

Syntax

PYTHON
exception NotADirectoryError

See Also

os.listdir() ENOTDIR