On Sun, Jul 12, 2026, at 21:13, Rob Cliffe via Python-list wrote: > It seems to be that it would be useful to have a FileReadOnly error. > Currently trying to delete a read-only file raises a PermissionError, > which not especially informative, and arguably even misleading.
First of all, how is it misleading? Second, there's no underlying difference in the error reported by the OS, so all of the same checking logic you describe below would have to be done internally. It might be worthwhile to have a separate error condition for windows *sharing* errors i.e. file cannot be opened/deleted/etc because another program has it open - which is a separate error code in the OS - but that's maybe a separate discussion. It might also be worthwhile to have a "delete harder" option in os.remove to have it take care of removing the readonly attribute for you on windows [but it probably should not change the directory permissions, only the file permissions, and this may be hard to explain in documentation] -- https://mail.python.org/mailman3//lists/python-list.python.org
