title: Python CGI permissions error
body: <p>I can't seem to open and write to a text file from my CGI script.. I keep getting permissions errors (which I see from CGITb)</p>
  
  <p>Whenever I try to do this:</p>
  
  <pre><code>f = open("/Users/varatis/Documents/data.txt","a+")
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>&lt;type 'exceptions.IOError'&gt;: [Errno 13] Permission denied: '/Users/varatis/Documents/data.txt' 
    args = (13, 'Permission denied') 
    errno = 13 
    filename = '/Users/varatis/Documents/data.txt' 
    message = '' 
    strerror = 'Permission denied'
  </code></pre>
  
  <p>Ideally, I'd want to create the text file. But to make things easier for the server, I've tried making things easier by making a premade data.txt, and running the usual:</p>
  
  <pre><code>chmod a+x data.txt
  chmod a+w data.txt
  chown 70 data.txt     (70 is the uid the server runs on, obtained by os.getuid from the os module)
  </code></pre>
  
  <p>however, these don't even seem to work. Does anyone have experience with this and can help me? Again, ideally I'm appending to the text file from the CGI script and creating it if it doesn't exist.</p>
  
  <p>Also, maybe of use will be the ls -la for the data.txt:</p>
  
  <pre><code>-rwxrwxrwx@ 1 _www  staff  0 Mar 12 16:18 data.txt
  </code></pre>