This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients danny87105, eryksun, iritkatriel
Date 2020-10-20.18:18:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603217894.76.0.180599308078.issue41737@roundup.psfhosted.org>
In-reply-to
Content
Regarding documentation, builtin open() and the io and os modules generally do not provide information about platform-specific errors. But documenting the behavior for the NotADirectoryError exception itself may be useful considering it applies to many POSIX functions that access filepaths, such as stat, open, mkdir, rmdir, unlink, and rename.

Regarding behavior, I don't see anything reasonable that can or should be done for POSIX. In Windows, it should be possible to know whether FileNotFoundError is due to a bad path prefix (ERROR_PATH_NOT_FOUND, 3) or a missing file (ERROR_FILE_NOT_FOUND, 2), but io.FileIO currently only uses standard C errno, which maps both of these cases to ENOENT. So one behavior that *can* be fixed in this situation is to get the actual Windows error code from MSVC _doserrno, such that the raised FileNotFoundError would have the relevant Windows error code in its winerror attribute.
History
Date User Action Args
2020-10-20 18:18:14eryksunsetrecipients: + eryksun, iritkatriel, danny87105
2020-10-20 18:18:14eryksunsetmessageid: <1603217894.76.0.180599308078.issue41737@roundup.psfhosted.org>
2020-10-20 18:18:14eryksunlinkissue41737 messages
2020-10-20 18:18:14eryksuncreate