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

Markus Kemp NutJob at gmx.net
Thu Nov 18 11:20:48 EST 2004


Hi Skip,

Skip Montanaro <skip at pobox.com> wrote in message news:<mailman.6498.1100715267.5135.python-list at python.org>...
> try:
>     f = open("somefile")
> except IOError:
>     print "file not readable"
> 

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 ...
Thanks for helping!

Regards,

Markus



More information about the Python-list mailing list