file mode attributes...
Bjorn Pettersen
BPettersen at NAREX.com
Fri Sep 13 20:04:26 EDT 2002
I was wondering if this was the best way of implmenting these functions
(windows)?
import os, stat
def isReadable(fname):
os.stat(fname).st_mode & stat.S_IREAD
def isWriteable(fname):
os.stat(fname).st_mode & stat.S_IWRITE
def makeReadable(fname):
os.chmod(fname, os.stat(fname).st_mode | stat.S_IREAD)
def makeWriteable(fname):
os.chmod(fname, os.stat(fname).st_mode | stat.S_IWRITE)
It seems rather round-about, especially since the stat attributes I'm
using aren't even mentioned in the manual...
-- bjorn
More information about the Python-list
mailing list