20 May
2004
20 May
'04
4:36 p.m.
I have been getting an error : 'file' object has no attribute 'append' I am trying to append a new user on my .htaccess file and once I figure this part I think the rest of my code will work perfectly. This is a snippet of where the error is coming from: Basically if the dirpath exists I want a new required user appended to the list. I am still new to python so if something looks really wacky - sorry. ;) def createUser(username, basedir): import os dirpath = "/var/www/html/da/" + basedir + "/.htaccess" if os.path.isfile(dirpath): filename=open(dirpath, 'a') filename.append('Require user ' + username + '\n') Thanks