On Tue, Jul 14, 2026, at 04:46, Alan Gauld via Python-list wrote: >> Bottom line: I think that having a FileReadOnly exception is a good >> idea because it more precisely reports the problem and gives users a >> direction for fixing it, whereas reporting permissions error doesn't. > > I don't disagree with this however. The more specific an error > the better.
The problem is that if Python wants to provide information that isn't provided in the error code from the operating system, it has to do a complex and potentially expensive root cause analysis on its own, checking for all the possible conditions that could have caused the error. Do you do this every time there is an error, or only when requested? having it be a subclass rather than a property makes 'only when requested' more difficult to design. And what if a secondary error is encounted while doing the analysis [e.g. you can't stat the file]? And should we also differentiate permission errors on unix that are caused by a missing 'execute' bit somewhere in the middle of the directory path, by checking each level of the path? -- https://mail.python.org/mailman3//lists/python-list.python.org
