title: Permission denied error while writing to a file in Python
body: <p>I want to create a file and write some integer data to it in python. For example, I have a variable abc = 3 and I am trying to write it to a file (which doesn't exist and I assume python will create it on its own):</p>
  
  <pre><code>fout = open("newfile.dat", "w")
  fout.write(abc)
  </code></pre>
  
  <p>First, will python create a newfile.dat on its own? Secondly, it's giving me this error:</p>
  
  <pre><code>IOError: [Errno 13] Permission denied: 'newfile.dat'
  </code></pre>
  
  <p>What's wrong here?</p>