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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:18:46+00:00 2026-05-23T14:18:46+00:00

I am a postdoc and I just finished a cool little scientific application in

  • 0

I am a postdoc and I just finished a cool little scientific application in Python and want to share it with the world. It’s a really useful tool for genetecists.

I’d really like to let people run this program through a CGI form interface. Since I’m not a student anymore, I no longer have webspace with a tidy little cgi-bin subdirectory that’s hooked up perfectly.

I wrote a simple CGI Python program a few years ago, and was trying to use this as a template.

Here is my quesion:
My program needs to create temporary files (when run from the command line it saves images to a given path).
I’ve read a couple tutorials on Apache, etc. and got lots of things running, but I can’t figure out how to let my program write temporary files (I also don’t know where these files would live, etc.). Any time I try to write to a file (in any manner) in my Python program, the CGI “crashes” and doesn’t seem OK.

I am not extremely worried about security because the temporary files will only be outputs of the program (not the user input).

And while I’m asking (I’m assuming you’re kind of a CGI ninja if you got this far and weren’t bored), do you know my CGI program can take a file argument without making a temporary file?

My previous approach to this was to simply take a list of text as an argument:

try:
    if item.file:
        data = item.file.read()
        if check:
            Tools_file.main(["ExeName", "-d", "-w " + data])
        else:
            Tools_file.main(["ExeName", "-s", "-d", "-w " + data])
...

I’d like to do this the right way! Cheers in advance.

Stack overflowingly yours,
Oliver

  • 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-23T14:18:46+00:00Added an answer on May 23, 2026 at 2:18 pm

    Well, the “right” way is probably to re-work things using an existing web framework like Django. It’s probably overkill in this case. Don’t underestimate the security aspects here. They’re probably more relevant than you think.

    All that said, you probably want to use Python’s temp file module from the standard library:

    http://docs.python.org/library/tempfile.html

    It’ll generally write stuff out to /tmp/whatever if you’re on unix. If your program is crashing only when run under apache (but runs fine when you execute it directly), check your permissions. Make sure your apache user has permission to write to wherever you’ve decided to store your temp files. Make sure the temp files are written with appropriate permissions (don’t want to write a file that you can’t read later on).

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

Sidebar

Related Questions

I want to display the values of a 100% bar for each part of
One little problem: I have this class for working with CouchDB in PHP. I
I have a div with elements below it that I am serializing. I am
I am having hard time converting a BasicHttpBinding to custom binding. Specifically I need
I am trying to create a simple blog that has code inclosed in <pre>
So I am creating trying to create a PHP script where the client can
I've got a gem that's used a bunch of people using a bunch of
I have a form where the user inserts data but they can go back
After inserting data using PouchDB I tried db.getAll() to retrieve all the documents and

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.