Can my python script return a value to the c program executing it?

vduber6er ericcngan at gmail.com
Fri Apr 21 15:06:32 EDT 2006


I have a C program that calls my python script by

exec_pycode(code);

code =  "import CheckFasta\nCheckFasta.CheckFasta (\"sampledata.txt\",
%d)\n", PyNum);

CheckFasta.py is my python script with a def CheckFasta in it that
returns a string.

Is there a way for my C code to get the return value from CheckFasta?

Example:
If CheckFasta returns "hello world"

can I somehow do something like

returnstring = exec_pycode(code);

where returnstring will contain "hello world" after the line above?

Thanks




More information about the Python-list mailing list