os.access() under windows

Tim Golden mail at timgolden.me.uk
Tue Dec 4 11:19:54 EST 2007


Martin v. Löwis wrote:
>> Martin. Could you confirm that the outline below correctly
>> describes the behaviour of the os.access function under
>> Windows, please?
> 
> It's correct for Python 2.5.2 and 2.6; for 2.5.1 (as discussed)
> the test "if directory:return True" was not implemented.

Thanks. Version dependent stuff noted.

> Notice that the first sentence:
> 
> "If the path does not exist or if access if forbidden, return False"
> 
> is confusing. It seems to say "access() returns false if access is
> forbidden". I think you are referring to the directory (in the sense
> of os.path.dirname) of the path to be tested.

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

TJG



More information about the Python-list mailing list