Solved

Python "os.system" calls using IIS6

Posted on 2009-05-13
2
786 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
2 Comments
 
LVL 22

Accepted Solution

by:
cj_1969 earned 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bot attack question 11 64
Find Files older than 6 months and then ZIP the Files 4 29
Select SamAccountName - powershell script 2 18
IIS 8 and certificate 8 21
This article will show, step by step, how to integrate R code into a R Sweave document
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

733 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