New submission from Charles Machalow <csm10...@gmail.com>:

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.

----------
messages: 363796
nosy: Charles Machalow
priority: normal
severity: normal
status: open
title: Pathlib path methods do not work with Window Dos devices
type: behavior
versions: Python 3.8

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

Reply via email to