title: Python can't overwrite file
body: <p>I am reading from a file, adding a line to it and then saving it back.
  In C# this would work - But not in Python. Can anyone tell me why?</p>
  
  <pre><code>f = "blogs/%s.comment" % blogtitle
  if os.path.isfile(f):
      temp = file(f).readlines()
      temp.append(comment)
  
      overr = open(f, "w") #line 13
      for l in temp: overr.write(l)
  </code></pre>
  
  <p>The error I get is <code>IOError: [Errno 13] Permission denied</code> at line 13</p>
  
  <p>I am running this file as a .wsgi in Apache and have 775 permissions in the folder where the file is stored.</p>