On Sun, Jul 12, 2026, at 21:13, Rob Cliffe via Python-list wrote:
>                      if st.st_mode & 0x92 == 0:
>                          errStr = 'File is read-only'

I feel like it should probably be mentioned that the st_mode value returned on 
windows is mostly synthetic, and while it does reflect the read-only attribute 
I don't *think* it reflects the ACLs, and certainly won't encapsulate all of 
the possible information in the ACL, which includes separate bits for deletion, 
writing, and appending. A fully general "figure out why this operation returned 
a PermissionError" [which could be caused by either file attributes or ACL 
flags on the file itself, ACLs on its parent directory, and maybe on any 
directory in its path] function would have to take all this into account.

Ultimately the 'problem' at hand is that for someone used to the Unix paradigm, 
creating or deleting a file is only determined by the permissions of the 
directory containing it, not the file itself, so looking at the file's own 
metadata seems counterintuitive if you're overindexed on that paradigm. But 
that is not a universal truth, nor is it in any way obvious that it *ought* to 
be that way. I don't think "PermissionError on a delete operation can be caused 
by the attributes of the file itself" is anywhere near surprising enough to 
need special casing just because it happens to not be true on Unix.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to