?
Solved

Python "os.system" calls using IIS6

Posted on 2009-05-13
2
Medium Priority
?
793 Views
Last Modified: 2013-12-25
I am executing a python script on a web server running Windows 2003, IIS6, and FastCGI.  I have have my web extensions all set up, and most python scripts run just fine from the browser.  It's only when I try to make "os.system" calls that things fail.

I have a script here that runs fine from command line and generates textfile.  When run from a web browser however, this does not work:
---------------------
import os
os.system('touch output.txt')
os.system('echo 1 >> output.txt')
---------------------

I have seen several others ask this same question all over the web since 2001, but no one ever seems to get a real answer.  Does anyone know why this does not work in IIS?  More importantly, does anyone know how to make this work in IIS?

Thanks.
0
Comment
Question by:m_mccabe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
cj_1969 earned 2000 total points
ID: 24384004
Chances are if you are running IIS 6 then the code is running using the Network Service account.  My guess is that this account does not have permission to execute the call you are making.

Try creating a new application pool and change the logon ID of the application pool to either Local System or create a local/domain account and grant it appropriate permissions and see if this fixes the problem.
0
 
LVL 3

Author Closing Comment

by:m_mccabe
ID: 31581151
Thanks a ton, cj_1969!  I tried your solution and it worked.  During this process, it also got me thinking about permissions, and in the end I only needed to grant the IUSR_%computername% account access to python.exe and cmd.exe.

Thanks so much for getting me on the right track.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sequence is something that used to store data in it in very simple words. Let us just create a list first. To create a list first of all we need to give a name to our list which I have taken as “COURSE” followed by equals sign and finally enclosed …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question