os.access giving incorrect results on Windows

Tim Golden mail at timgolden.me.uk
Thu May 19 16:08:15 EDT 2011


On 19/05/2011 20:56, Andrew Berg wrote:
> On 2011.05.19 02:43 PM, Tim Golden wrote:
>> This is basically issue2528 [1].
>> The problem is that, although Windows (and Python)
>> expose a version of os.access to match the Posix function,
>> the meaning is so far removed on Windows as to be useless.
> Does this affect just os.W_OK and directories or all of os.access()?
>
> In any case, this information should really be reflected in the docs.

The current code is very naive:

* A R_OK check always succeeds if the file's attributes can be read
   at all
* A W_OK check fails if the file has its DOS read-only attribute set
* A W_OK check always succeeds for a directory (because read-only means
   something else for directories).

Would you care to propose some wording for the docs? I'm quite happy
to commit if we can come to an agreement.

TJG



More information about the Python-list mailing list