Execute a command from a cgi script

fishboy fishboy at spamspamspam.com
Mon Jun 7 05:17:11 CEST 2004

On 6 Jun 2004 19:51:59 -0700, tedlandis at rogers.com (Ted) wrote:

>fishboy <fishboy at spamspamspam.com> wrote in message news:<8735c09t40h6nnavhnt9plc4ad8t6jdrrm at 4ax.com>...
>> On 2 Jun 2004 21:28:37 -0700, tedlandis at rogers.com (Ted) wrote:
>> >Hi all,
>> >
>> >I am trying to execute a batch file from a python cgi script on an IIS
>> >webserver on Win2K. I have changed all the permissions I can think of.
>> >The command I am using is:
>> >
>> >p = os.spawnl(os.P_WAIT, 'spameggs.bat')
>> >
>> >I am using spawn because I need the Wait, but I have tried popen* and
>> >command and none of them work either.
>> >
>> >The odd thing is that if I embed the python code in an asp page it
>> >works just fine. I am aware there are a lot of variables here but has
>> >anyone seen anything like this before?
>> >
>> >Thanks,
>> >Ted
>> try os.system()?
>> ><{{{*>
>Yes, I've tried popen, system, spawn and even the win32 library
>wscript stuff. None of them run.

Have you checked where the script thinks it's running with
os.getcwd()?  The other thing is permissions.  
Or.... (quick search for 'IIS cgi system() call')


Not specifically a Python thing, I think.

os.getpid() and os.getenv() could also tell you more about the process
and the environment it's running in.


More information about the Python-list mailing list