Message379150
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. |
|
Date |
User |
Action |
Args |
2020-10-20 18:18:14 | eryksun | set | recipients:
+ eryksun, iritkatriel, danny87105 |
2020-10-20 18:18:14 | eryksun | set | messageid: <1603217894.76.0.180599308078.issue41737@roundup.psfhosted.org> |
2020-10-20 18:18:14 | eryksun | link | issue41737 messages |
2020-10-20 18:18:14 | eryksun | create | |
|