Message 333748 - Python tracker

Message333748

Author eryksun
Recipients Jordan Hueckstaedt, eryksun, paul.moore, pitrou, steve.dower, tim.golden, zach.ware
Date 2019-01-16.01:36:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547602573.92.0.52509733813.issue35692@roundup.psfhosted.org>
In-reply-to
Content
> 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
History
Date User Action Args
2019-01-16 01:36:16eryksunsetrecipients: + eryksun, paul.moore, pitrou, tim.golden, zach.ware, steve.dower, Jordan Hueckstaedt
2019-01-16 01:36:13eryksunsetmessageid: <1547602573.92.0.52509733813.issue35692@roundup.psfhosted.org>
2019-01-16 01:36:13eryksunlinkissue35692 messages
2019-01-16 01:36:13eryksuncreate