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 7624789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:03:41+00:00 2026-05-31T05:03:41+00:00

I can’t seem to open and write to a text file from my CGI

  • 0

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)

Whenever I try to do this:

f = open("/Users/varatis/Documents/data.txt","a+")

I get this:

<type 'exceptions.IOError'>: [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'

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:

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)

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.

Also, maybe of use will be the ls -la for the data.txt:

-rwxrwxrwx@ 1 _www  staff  0 Mar 12 16:18 data.txt
  • 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-05-31T05:03:43+00:00Added an answer on May 31, 2026 at 5:03 am

    Very likely your webserver doesn’t have permissions to write to that specific directory.
    If it’s an apache then you might want to fiddle around with ‘Directory’ directive.

    update:
    What are the permissions on the Documents directory?

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

Sidebar

Related Questions

Can we write all the control events in a seperate class file in different
Can someone help me with this scenario? *There is a button, which when tapped,
Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can't seem to get the Back Button to appear in a UINavigationController flow. I
Can I convert a pdf to pcl file with ghostscript? I'm using Ghostscript 9.01
Does anyone know how can I replace this 2 symbol below from the string
I have a bunch of posts stored in text files formatted in yaml/textile (from
Can anyone tell which Javascript framework is being used for http://iphone.paulmillersubaru.com/index.htm#index_p_2Ehtm Is this based
Can this query below be optimized? select max(date), sysdate - max(date) from table; Query
Can a DateTime value be NULL ? I have this code: From here I

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.