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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:47:25+00:00 2026-05-15T18:47:25+00:00

Can I use os.system() or subprocess.call() to execute a Python program on a webserver?

  • 0

Can I use os.system() or subprocess.call() to execute a Python program on a webserver?

I mean can I write these functions in a .py script and run it from a web browser and expect the program to be executed?

Thanks a lot.

EDIT:
Sorry for all the confusion, I am giving you more background to my problem.

The reason I am trying to do is this.
I have a Python program that accepts an XML file and returns me TTF file.
I run that program in terminal like this:

ttx somefile.xml 

After which it does all the work and generates a ttf file.
Now when I deploy this script as a module on web server. I use a to allow user to browse and select the XML file.
Then I read the file data to temporary file and then pass the file to the module script to be executed like this:

ttx.main([temp_filename]) 

Is this right way to do it? Because at this point, I don’t get any error in the log or in browser. I get blank screen.

When this didn’t work, I was going to try os.system or subprocess.call

  • 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-15T18:47:26+00:00Added an answer on May 15, 2026 at 6:47 pm

    So long as your server is configured to run CGI scripts (Apache’s documentation for that is here, for example), yes, you can execute a python script from a webserver. Simply make sure the script is in the appropriate cgi-bin/ directory and that the file has executable permission on the server.

    With regards to your comments:

    1. You can, if you really want, explicitly allow other folders on the server to run executable code. I don’t know what server you’re using, but on Apache this is done by setting Option +ExecCGI for the folder you want. Again, see the docs I linked to.
    2. You need to give an absolute path with respect to the server. As an example, a site I develop has the layout: /public_html/cgi-bin/ When I want to access .cgi or .py files, the url for the site is something like http://chess.narnia.homeunix.com/cgi-bin/index.cgi. You can also set up re-directs to certain files if you want.
    3. One way to pass parameters through your browser is to append them to the URL like an HTTP POST method. Here’s a good example of doing that.

    Is that what you were looking for with your question, or did you want to actually invoke the python script with os.system()?

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

Sidebar

Ask A Question

Stats

  • Questions 488k
  • Answers 488k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It looks like this isn't possible at the moment with… May 16, 2026 at 8:48 am
  • Editorial Team
    Editorial Team added an answer Not an answer to your question, but one view is… May 16, 2026 at 8:48 am
  • Editorial Team
    Editorial Team added an answer Other people have already answered the first part of your… May 16, 2026 at 8:48 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm working on a simple Python script that can use subprocess and/or os to
I want to write some python package installing script in Python into virtualenv. I
I would like to use python to make system calls to programs and time
I have a Python script that calls an executable program with various arguments (in
You can use system properties in log4j configuration files using a ${variablename} syntax. Can
I know I can use System.DirectoryServices to roll my own GAL Name/email selector control
My aspx page is hosted by Discountasp.net. I can use System.Net.Mail.MailMessage to send an
I'm trying to create a Python script that would : Look into the folder
First let me say that I know it's better to use the subprocess module,
I use Java Runtime.getRuntime().exec(command) to create a subprocess and print its pid as follows:

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.