#! /usr/bin/env python
import os
import stat
import sys
class chkup:
def set(file):
filepermission = os.stat(file)
user_read()
user_write()
user_exec()
def user_read():
"""Return True if 'file' is readable by user
"""
# Extract the permissions bits from the file's (or
# directory's) stat info.
b = bool(filepermission.st_mode & stat.S_IRUSR)
print b
return b
def user_write():
"""Return True if 'file' is readable by user
"""
# Extract the permissions bits from the file's (or
# directory's) stat info.
b = bool(filepermission.st_mode & stat.S_WRUSR)
print b
return b
def user_exec():
"""Return True if 'file' is readable by user
"""
# Extract the permissions bits from the file's (or
# directory's) stat info.
b = bool(filepermission.st_mode & stat.S_IXUSR)
print b
return b
def main():
i = chkup()
place = '/net/home/f08/itsrsw1/ScriptingWork/quotacheck'
i.set(place)
if __name__ == '__main__':
main()
With that code I receive
> Traceback (most recent call last):
File "chkup.py", line 46, in <module>
main()
File "chkup.py", line 43, in main
i.set(place)
TypeError: set() takes exactly 1 argument (2 given)
Any thoughts?
Thanks in advance