[Tutor] file permissions
Gabriel Farrell
gsf at panix.com
Wed Dec 7 21:42:56 CET 2005
On Wed, Dec 07, 2005 at 11:52:20AM -0800, Danny Yoo wrote:
> On Wed, 7 Dec 2005, Eric Walker wrote:
>
> > Looking for easiest way to get a files permissions in linux.
>
> Hi Eric,
>
> What have you looked at so far?
I agree with Danny, the question lacks any evidence of prior
investigation on the part of the poster, and that makes it a lousy
candidate for the helpful guidance of the python tutor list. The
documentation on this aspect of python, however, is pretty sparse, and
the answer's not exactly intuitive, so I thought I'd mention the
effbot's page about the os module as a good place to look, in addition
to the documentation Danny listed.
http://effbot.org/librarybook/os.htm
What he's written there should be able to answer your question.
If I may hijack the thread, does anyone more knowledgeable than me
know why os.stat and stat are so low-level and esoteric? Am I crazy
for wanting to replace
oct(stat.S_IMODE(os.stat(thefile)[stat.ST_MODE]))
with, say,
stat.getmode(os.stat(thefile))
or even
os.getmode(thefile)
?
More information about the Tutor
mailing list