newbie os.stat question

Tipton Bandy tipton51 at subdimension.moc
Thu Apr 3 13:18:08 EST 2003


I've got my first python utility working pretty good, but
I just need help on one point.

I need to test a filename and return true or false based on 
whether the file is readable and writable by the user running
my utility. Oh, yes, this is on Linux:)
I'm used to writing things like, 'if [ -w $filename ]' in bash.

I think I should use os.stat() somehow, but it seems like a lot
of code would be required to check the appropriate field (user,
group, or others) based on the ownership of the file and the
uid of the user.

This seems like such a common thing.  Is there a pre-written function
to handle it?

Thanks in advance,
Tipton




More information about the Python-list mailing list