Executing a C program from Python

vishakha vaibhav vishakha406 at yahoo.com
Mon Apr 6 19:56:03 CEST 2009

I am very new to python. I have my cgi script written in Python. My CGI script should call a C program and collect the value returned by this program and pass it to the browser.
Can anyone help me out in this. How can I execute the c program and collect the return value.
I tried,
import os
a=os.system("my-app")//my-app is the C program executable
print a
But the variable a prints 0 everytime. It should return a non-zero value as per my C program.  Is there any method to do what I need.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090406/c99aee09/attachment.html>

More information about the Python-list mailing list