Python CGI & File Permissions

Kevin Cazabon kevin at cazabon.com
Tue Dec 18 19:50:37 EST 2001


I had a similar problem when trying to create a directory with
os.mkdir(path, mode).  Even though I passed 0777 as mode, it only
created it as -rwxrw-rw-.  The documentation says that should work,
but it didn't for me (Python 1.5.2 and 2.1)

I ended up giving up and using os.system("mkdir -m 777 path").

Kevin.

bwaskiew at indiana.edu (Brian Waskiewicz) wrote in message news:<6456b489.0112181009.3407d52b at posting.google.com>...
> I'm trying to use a Python CGI script to write a text file on a
> Unix/Apache webserver. The problem is that the file created is owned
> by 'nobody' and has permissions '-rw-r--r--'.  I need to read and
> append to the file in other scripts, so I need some way of changing
> the file permissions.  I tried os.chmod() and that didn't work.
> 
> Thanks.



More information about the Python-list mailing list