Eryk Sun <eryk...@gmail.com> added the comment:

> There's no reason a non-existing drive should fail differently than 
> a non-existing parent directory.

The drive exists (or should) if we're getting ERROR_NOT_READY (21). It's likely 
a removable media device, such as an optical disc or card reader, and there's 
no media in the device. 

If a logical drive isn't defined at all, we should get ERROR_PATH_NOT_FOUND 
(from the NT status value STATUS_OBJECT_PATH_NOT_FOUND). This gets mapped to 
the errno value ENOENT, which is already handled. For example:

    >>> os.stat('Q:/')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'Q:/'

    >>> pathlib.Path('Q:/whatever/blah.txt').exists()
    False

Similarly if a UNC 'drive' doesn't exist, we should get ERROR_BAD_NET_NAME 
(from NT STATUS_BAD_NETWORK_NAME), which is also mapped to ENOENT:

    >>> os.stat('//some/where')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    FileNotFoundError: [WinError 67] The network name cannot be found: 
'//some/where'

    >>> pathlib.Path('//some/where/whatever/blah.txt').exists()
    False

----------

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

Reply via email to