This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Charles Machalow
Recipients Charles Machalow
Date 2020-03-10.01:04:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583802295.48.0.863493828127.issue39920@roundup.psfhosted.org>
In-reply-to
Content
I ran the following as admin in the Python interpreter (on Windows):


>>> d = pathlib.Path(r'\\.\PHYSICALDRIVE0')
>>> print(d)
\\.\PHYSICALDRIVE0\
>>> d.exists()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37\lib\pathlib.py", line 1318, in exists
    self.stat()
  File "C:\Python37\lib\pathlib.py", line 1140, in stat
    return self._accessor.stat(self)
PermissionError: [WinError 31] A device attached to the system is not functioning: '\\\\.\\PHYSICALDRIVE0\\'
>>> d.is_char_device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37\lib\pathlib.py", line 1403, in is_char_device
    return S_ISCHR(self.stat().st_mode)
  File "C:\Python37\lib\pathlib.py", line 1140, in stat
    return self._accessor.stat(self)
PermissionError: [WinError 31] A device attached to the system is not functioning: '\\\\.\\PHYSICALDRIVE0\\'
>>> d.is_block_device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37\lib\pathlib.py", line 1390, in is_block_device
    return S_ISBLK(self.stat().st_mode)
  File "C:\Python37\lib\pathlib.py", line 1140, in stat
    return self._accessor.stat(self)
PermissionError: [WinError 31] A device attached to the system is not functioning: '\\\\.\\PHYSICALDRIVE0\\'

I think that exists(), is_char_device(), and is_block_device() should be able to work on Windows in some form or fashion. At least without a traceback.
History
Date User Action Args
2020-03-10 01:04:55Charles Machalowsetrecipients: + Charles Machalow
2020-03-10 01:04:55Charles Machalowsetmessageid: <1583802295.48.0.863493828127.issue39920@roundup.psfhosted.org>
2020-03-10 01:04:55Charles Machalowlinkissue39920 messages
2020-03-10 01:04:55Charles Machalowcreate