On 2018-06-11 00:28:11 +0300, Marko Rauhamaa wrote: > Barry Scott <ba...@barrys-emacs.org>: > > Singling out os.path.exists as a special case I do think is > > reasonable. > > I don't think anyone has proposed that. While I brought up > os.path.exists() in my bug report, os.path.isfile(), os.path.isdir() etc > should obviously be addressed simultaneously.
Yes. > It may even be that the fix needs to go to os.stat(). That's for the > Python gods to decide. I'm not a Python god, but I don't think os.stat() should be changed. That already throws different exceptions for different errors: >>> os.stat("nix") Traceback (most recent call last): File "<stdin>", line 1, in <module> FileNotFoundError: [Errno 2] No such file or directory: 'nix' >>> os.stat("/lost+found/foo") Traceback (most recent call last): File "<stdin>", line 1, in <module> PermissionError: [Errno 13] Permission denied: '/lost+found/foo' >>> os.stat("\0") Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: embedded null byte I think this is worth keeping, and "I couldn't pass that file name to the OS" is a different error than "the OS told me the file doesn't exist", so I think it should be a different exception. hp -- _ | Peter J. Holzer | we build much bigger, better disasters now |_|_) | | because we have much more sophisticated | | | h...@hjp.at | management tools. __/ | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list