Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8733063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:34:06+00:00 2026-06-13T09:34:06+00:00

I’ve got a python script that’s being executed remotely. The final segment of this

  • 0

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.

The script is being executed over ssh:

ssh -c blowfish remoteAddr python -u pythonScript.py $1 $2 $3

This allows arguments passed into the script (I’m using bash) to become inputs to the python script.

On the remoted end, my attempts to create an output file (.csv) have proven useless:

csvFile = open('results.csv','w')
csvFile.write(someResults)
csvFile.close()

returns an IOError (Errno 13): Permission denied ‘results.csv’. The error is marking my open as the culprit.

performing an ls -l on the directory the python is being executed on, I get:

-rwxr-xr-x 1 jmschen operations 5003 <dateTimeStamp> pythonScript.py

Which makes me think that I should have no problems with access. Also, I have tried the following:

os.chmod(<WherePythonScriptLives>,0777)
csvFile = open("results.csv","w")
csvFile.write(someResults)
csvFile.close()

This also produces the same error.

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)

import os
f = open("results.csv","w")
f.write("Blah Blah Blah")
f.close()

works just fine. This makes me think that the fact we’re executing python remotely might be the issue?

Requirements:

  • Python 2.4.3 on Unix (Can’t upgrade)
  • No external modules/packages (not that I think we’d need them for this)
  • Can’t change the ssh -c blowfish remoteAddr python -u pythonScript.py $1 $2 $3 call This requirement is removed since the ssh call might be the culprit.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:34:07+00:00Added an answer on June 13, 2026 at 9:34 am

    If I understand your question correctly…

    I ran into a similar situation yesterday where php was meant to execute an external python script. I was mistaking my user permissions with php-user permissions. I had to used chmod() in php.

    Through researching your question I discovered the Python equivalent. Try this:

    import os
    
    os.chmod(path, mode)
    csvFile = open('<fullpath>/results.csv','wt')
    csvFile.write(someResults)
    csvFile.close()
    

    This is much the same process I had with my php example. Please note, the mode default is octal, so if giving full permission, mode should be 0777 vs the terminal’s 777.

    I hope this helps!

    *Untested

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a small JavaScript validation script that validates inputs based on Regex. I
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I know there's a lot of other questions out there that deal with this
I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.