[New-bugs-announce] [issue21516] pathlib.Path(...).is_dir() crashes on readonly directories (Windows)

Thomas Heller report at bugs.python.org
Fri May 16 16:45:36 CEST 2014


New submission from Thomas Heller:

On Windows, pathlib.Path(...).is_dir() crashes on readonly directories while os.path.isdir(...) works fine.  Example on Windows7:

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path, pathlib
>>> os.path.isdir("c:\\Users\\admin")
True
>>> pathlib.Path("c:\\Users\\admin").is_dir()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\pathlib.py", line 1197, in is_dir
    return S_ISDIR(self.stat().st_mode)
  File "C:\Python34\lib\pathlib.py", line 1045, in stat
    return self._accessor.stat(self)
  File "C:\Python34\lib\pathlib.py", line 323, in wrapped
    return strfunc(str(pathobj), *args)
PermissionError: [WinError 5] Zugriff verweigert: 'c:\\Users\\admin'
>>>

This probably affects other methods that call stat() internally.

----------
components: Library (Lib)
messages: 218664
nosy: theller
priority: normal
severity: normal
status: open
title: pathlib.Path(...).is_dir() crashes on readonly directories (Windows)
type: crash
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21516>
_______________________________________


More information about the New-bugs-announce mailing list