Need function to test if EFFECTIVE UID has read-access to a file.

Diez B. Roggisch deetsNOSPAM at
Thu Nov 18 17:39:12 CET 2004

> Ow, is that the only way? =( Because as I see it, open() is a
> relatively costly function compared to something like os.access(), and
> since I'll be calling the function thousands of times in a row it'd be
> really cool if there was something similar to os.access(). But if
> there isn't I guess that'll have to do ...

I didn't measure it, but I bet open internally uses the same function
os.access uses - so in case of failure, you won't have lost much, if
anything at all.

Now for the positive case: if you actually want to _do_ something with that
file, you might needed an open anyway?


Diez B. Roggisch

More information about the Python-list mailing list