John Machin wrote: > Shuaib wrote: > > Hi! > > > > I have a python script which returns an Integer value. How do I call > > this script from a C programe, and use the result returned? > > To avoid confusion and possible irrelevant responses, please say which > of the following options best matches your requirement: > > (a) your Python script is capable of being run from the command line, > and "returns" an integer value by calling sys.exit(that_value) -- you > wish to execute the script from a C program [the same way you would > execute a shell script / awk script / ...] and pick up the return value > [which may be limited by the OS to range(0, 128)] > > (b) your script is a module, containing a function that returns an > integer. You wish to create an embedded Python interpreter, import > yourmodule, call yourmodule.yourfunc, convert the returned Python int > to a C int, and use it.
(b) it is. :) -- http://mail.python.org/mailman/listinfo/python-list