Danny Lin added the comment:
I'm not so familiar about the spec. If such behavior is confirmed due to
implementation difference across OSes, and it's also not desirable to change
the mapping of the OS error to Python exception, we can simplify left it as-is.
However, this behavior difference
Eryk Sun added the comment:
> if NotADirectoryError should be raised, it should mention '/path/to/file'
> rather then '/path/to/file/somename.txt'.
POSIX specifies that C open() should set errno to ENOTDIR when an existing path
prefix component is neither a directory nor a symlink to a direc
New submission from Danny Lin :
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\fi