I have this code:
import os
print(os.access("tst.txt", os.R_OK))
open("tst.txt", "rb")
# File Permissions:
# Owner: Trusted Installer
# Administrators and my user: deny all permissions
os.access returns True but opening the file raises a PermissionError exception.
And if I try this on another file (like cmd.exe, notepad.exe, System32 dir itself, or ANY other file) it always returns True.
If a file is non-existent it return False.
SO: True on any existing file. Even if there is no write access.
I couldn't find anything about this on the Internet.
Does anybody know why this issue occurs?
EDIT: Of course my script is not running as Administrator.
No matter if I test read or write access.