python file permisions

Brett Irving balgorg at hotmail.com
Wed May 21 03:37:58 EDT 2003


Can someone please help, Im having no luck with this
I want to set file permissions inside python for when I create
directories or files

This is one of my functions

def AddUser(username,userdata):
    users_db = dumbdbm.open('../dbase/mydumbdbm')
    os.system("chmod 777 ../dbase/mydumbdbm.*")
    users_db[username] = userdata
    users_db.close()
    os.system("chmod 777 ../dir/dir/*")

If the database is not there it gets created and then chmoded to 777
but its not letting me do that and keeps appearing with 500 server
error

log file error: IOError: [Errno 13] Permission denied:
'../dbase/mydumbdbm.dat'

If somebody could tell me how to set file permissions when I am
creating files it would be greatly appreciated.




More information about the Python-list mailing list