Message376505
On Linux (tested on Ubuntu 16.04), if "/path/to/file" is an existing file, the code:
open('/path/to/file/somename.txt')
raises NotADirectoryError: [Errno 20] Not a directory: '/path/to/file/somename.txt'
On Windows, similar code:
open(r'C:\path\to\file\somename.txt')
raises FileNotFoundError: [Errno 2] No such file or directory: 'C:\\path\\chrome\\to\\file\\somename.txt'
I think the behavior on Linux is not correct. The user probably cares about the existence of the file to be opened, rather than whether its ancestor directories are valid.
OTOH, if NotADirectoryError should be raised, it should mention '/path/to/file' rather then '/path/to/file/somename.txt'. But what if '/path/to' or '/path' is actually a file? Should it be '/path/to' or '/path' instead for the same reason? |
|
Date |
User |
Action |
Args |
2020-09-07 15:36:37 | danny87105 | set | recipients:
+ danny87105 |
2020-09-07 15:36:37 | danny87105 | set | messageid: <1599492997.14.0.974001441191.issue41737@roundup.psfhosted.org> |
2020-09-07 15:36:37 | danny87105 | link | issue41737 messages |
2020-09-07 15:36:37 | danny87105 | create | |
|