[Python-Dev] os.access on Windows

"Martin v. Löwis" martin at v.loewis.de
Fri May 20 23:56:01 CEST 2011


> TBH I think the less attractive we can make os.access() look the
> better. It uses the real uid instead of the effective uid, it
> encourages LBYL behavior, the outcome may be incorrect, it doesn't
> work on Windows... The ONLY reason to ever use it is in a setuid()
> program. But who writes those any more? (Esp. in Python!)

+1. The best way to determine "could I access this file" is to try
to access it, and be prepared to get an exception. So we might
deprecate-then-delete it on Windows.

People who *really* need to know in advance should use the Windows
API for that on Windows (i.e. call AccessCheck).

Regards,
Martin


More information about the Python-Dev mailing list