Eryk Sun added the comment:
When an open attempts to access a directory as data, the error code from WinAPI
CreateFileW is ERROR_ACCESS_DENIED (5), which maps to C EACCES and thus raises
Python PermissionError.
Python's io.FileIO() type could handle an EACCES error in Windows by checking
f
New submission from Jairo Llopis :
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
>>> pa