> It seems that the os.open API cannot distinguish between a permission error > and the fact that a directory cannot be opened like files. > The following script reproduces the scenario (tested on Python 3.8.2 > (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on > win32) : > > *import osos.system('mkdir someDirectory')open("someDirectory")* > > *Result:* > > *Traceback (most recent call last): File "<stdin>", line 1, in > <module>PermissionError: [Errno 13] Permission denied: 'someDirectory'*
It errors as expected for me: ``` Traceback (most recent call last): File "/tmp/throwaway.py", line 4, in <module> open("someDirectory") IsADirectoryError: [Errno 21] Is a directory: 'someDirectory' ``` Are you able to write a simple file instead? ``` import pathlib pathlib.Path("throwaway.txt").write_text("Test successful") ``` -- https://mail.python.org/mailman/listinfo/python-list