os.access() under windows

Tim Golden mail at timgolden.me.uk
Tue Dec 4 12:03:52 EST 2007


Martin v. Löwis wrote:
>> Now, ironically, I'm confused by your recap :) What I meant to say was
>> that the os.access function as implemented under Windows returns False
>> if the path in question (say, "x:\someones-private-docs\diary.doc") was
>> inaccessible to the process invoking os.access by virtue of file
>> system permissions. (Or, even, that it simply didn't exist).
> 
> Isn't that exactly the question that access() is trying to answer?
> (whether the file is inaccessible?)
> Then the reader could say "if it's inaccessible, return False,
> otherwise, return True". It suggests that we already have a mechanism
> to determine accessibility.

Up to a point: this meets the case where we fail to access
the file at all (for read or write or whatever). But what
about where we can read the directory entry, and the
read-only attribute isn't set? At present, we'll return
True to a W_OK access check in these circs, but this user
might in fact be denied write access by the ACLs. (In fact,
they might even be denied read access, since I imagine we
only need access to the directory entry to check the
attributes).

Have I missed something?

BTW I can't see a tutorial in the AccessCheck docs here:

   http://msdn2.microsoft.com/en-us/library/aa374815.aspx

or in the SDK help file. Were you referring to a different
set of docs? I'm girding my loins to provide a patch if I
can!

TJG



More information about the Python-list mailing list