Message386103
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' |
|
Date |
User |
Action |
Args |
2021-02-01 20:16:33 | Jairo Llopis | set | recipients:
+ Jairo Llopis, paul.moore, tim.golden, zach.ware, steve.dower |
2021-02-01 20:16:33 | Jairo Llopis | set | messageid: <1612210593.79.0.943479970127.issue43095@roundup.psfhosted.org> |
2021-02-01 20:16:33 | Jairo Llopis | link | issue43095 messages |
2021-02-01 20:16:33 | Jairo Llopis | create | |
|