[issue41737] Improper NotADirectoryError when opening a file in a fake directory

Irit Katriel report at bugs.python.org
Tue Oct 20 10:53:27 EDT 2020


Irit Katriel <iritkatriel at yahoo.com> added the comment:

> I don't think a general developer would expect that open('/path/to/file/somename.txt') implies a directory operation, and it also doesn't on Windows.


Really? It's not obvious that finding a file would involve directory operations?

In what sense does it even matter whether you expect a directory operation to happen? The contract is that if the open() fails you get an OSError. The documentation doesn't say which OSError, and that is in fact a platform-specific implementation detail.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41737>
_______________________________________


More information about the Python-bugs-list mailing list