os.access() under windows

"Martin v. Löwis" martin at v.loewis.de
Tue Dec 4 11:40:21 EST 2007


> 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.

The case you are referring to is when GetFileAttributes fails, with
a permission error, right?

I'm not quite sure why it could fail in cases where the file is
present, in particular, if the user has the privilege to bypass
traversal checking.

Regards,
Martin



More information about the Python-list mailing list