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 Jairo Llopis
Recipients Jairo Llopis, paul.moore, steve.dower, tim.golden, zach.ware
Date 2021-02-01.20:16:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612210593.79.0.943479970127.issue43095@roundup.psfhosted.org>
In-reply-to
Content
Trying to read a directory on Linux raises the expected exception:

Python 3.9.1 (default, Jan 20 2021, 00:00:00) 
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pathlib
>>> pathlib.Path(".venv").read_text()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.9/pathlib.py", line 1255, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/lib64/python3.9/pathlib.py", line 1241, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
IsADirectoryError: [Errno 21] Is a directory: '.venv'


Doing the same on Windows raises a misleading permission error instead:

>>> import pathlib
>>> pathlib.Path(".venv").read_text()
Traceback (most recent call last):   
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1255, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1241, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1109, in _opener
    return self._accessor.open(self, flags, mode)
PermissionError: [Errno 13] Permission denied: '.venv'
History
Date User Action Args
2021-02-01 20:16:33Jairo Llopissetrecipients: + Jairo Llopis, paul.moore, tim.golden, zach.ware, steve.dower
2021-02-01 20:16:33Jairo Llopissetmessageid: <1612210593.79.0.943479970127.issue43095@roundup.psfhosted.org>
2021-02-01 20:16:33Jairo Llopislinkissue43095 messages
2021-02-01 20:16:33Jairo Llopiscreate