错误代码门户
PythonPython错误代码

NotADirectoryError

NotADirectoryError

代码 NotADirectoryError · Python 报告的问题。

当对非目录的内容请求目录操作(例如 os.listdir())时引发。在大多数 POSIX 平台上,如果操作尝试打开或遍历非目录文件(就像它是目录一样),也可能会引发该错误。对应于 errno ENOTDIR。

Google Translate · 此内容为自动翻译。技术术语及适用条件请以英文原文为准。

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.

故障排除与诊断链接

请先确认文档中的产品、版本及发生环境与当前情况一致。