Eryk Sun added the comment:

Yes, I think this issue should be closed. But for the record I'd like to note a 
not uncommon case in which listdir() raise FileNotFoundError on Windows.

According to MS-FSA [1], if a request to open a directory resolves to a file, 
the operation should fail with STATUS_NOT_A_DIRECTORY (see 2.1.5.1, phase 7). 
That's the scenario I was discussing in previous messages. However, I neglected 
to discuss what happens when an intermediate path component is not a directory. 
In theory this case should also fail with STATUS_NOT_A_DIRECTORY (see 2.1.5.1, 
phase 6). However, in practice MS file systems instead return 
STATUS_OBJECT_PATH_NOT_FOUND, which becomes ERROR_PATH_NOT_FOUND, for which 
Python raises FileNotFoundError.

Walking the path to find the reason for the failure shouldn't be attempted 
because it's subject to race conditions -- e.g. the file that caused the 
failure may no longer exist. 

[1]: https://msdn.microsoft.com/en-us/library/ff469536.aspx

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29366>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to