Execute a command from a cgi script

T

Ted

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
 
F

fishboy

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()?
 
F

fishboy

Yes, I've tried popen, system, spawn and even the win32 library
wscript stuff. None of them run.
Hmmm,

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')

http://support.microsoft.com/?id=311481

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.

Hth,
 
S

simo

I'm not going to say "that will teach you for using Windows/IIS
instead of Linux/Apache" ;o)

Anyway, what errors, if any are you getting?

Are you sure it's not a path issue - like where on your filesystem is
your Python CGI script in comparison with the .bat file? Same
directory?

Is perhaps the problem the batch file and not actually the Python
script (maybe the batch file is not returning anything to Python?)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,652
Latest member
Campbellamy

Latest Threads

Top