title: Remote python script creating a .csv file (Permission Denied)
body: <p>I've got a python script that's being executed remotely.  The final segment of this code is supposed to create an output file in the script's directory (remote) for further reporting.</p>
  
  <p>The script is being executed over ssh:</p>
  
  <pre><code>ssh -c blowfish remoteAddr python -u pythonScript.py $1 $2 $3
  </code></pre>
  
  <p>This allows arguments passed into the script (I'm using bash) to become inputs to the python script.</p>
  
  <p>On the remoted end, my attempts to create an output file (.csv) have proven useless:</p>
  
  <pre><code>csvFile = open('results.csv','w')
  csvFile.write(someResults)
  csvFile.close()
  </code></pre>
  
  <p>returns an IOError (Errno 13): Permission denied 'results.csv'.  The error is marking my open as the culprit.</p>
  
  <p>performing an <code>ls -l</code> on the directory the python is being executed on, I get:</p>
  
  <pre><code>-rwxr-xr-x 1 jmschen operations 5003 &lt;dateTimeStamp&gt; pythonScript.py
  </code></pre>
  
  <p>Which makes me think that I should have no problems with access.  Also, I have tried the following:</p>
  
  <pre><code>os.chmod(&lt;WherePythonScriptLives&gt;,0777)
  csvFile = open("results.csv","w")
  csvFile.write(someResults)
  csvFile.close()
  </code></pre>
  
  <p>This also produces the same error.</p>
  
  <p>running this code locally (after sshing into the terminal) gives the same IOError; However, a python script that I created in the directory (test.py)</p>
  
  <pre><code>import os
  f = open("results.csv","w")
  f.write("Blah Blah Blah")
  f.close()
  </code></pre>
  
  <p>works just fine.  This makes me think that the fact we're executing python remotely might be the issue?</p>
  
  <p>Requirements:</p>
  
  <ul>
  <li>Python 2.4.3 on Unix (Can't upgrade)</li>
  <li>No external modules/packages (not that I think we'd need them for this)</li>
  <li><del>Can't change the <code>ssh -c blowfish remoteAddr python -u pythonScript.py $1 $2 $3</code> call</del> This requirement is removed since the ssh call might be the culprit.</li>
  </ul>