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

Related Questions

I'm working on a simple Python script that can use subprocess and/or os to
I want to write a Python script that runs another program, reading the output
I want to write a python script (Yes not Bash) that will use flac
I am trying to run an awk script using python, so I can process
How Can I use my system as a tomcat server ? Like tomcat server
I want to read the html file.And for that I use System.IO.File.ReadAllText(path) .It can
Can someone show me how to use the System.Numerics.BigInteger datatype? I tried using this
I would like to create/use a system-wide independent universal 'counter object' that can be
I'm looking to create an ID system for cataloging images. I can't use md5()
In the Derby server, how can you use the information in the system tables

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.