embedded Python sample
syver-en+usenet at online.no
Tue Sep 10 19:05:18 CEST 2002
monnetb at yahoo.com (bruno Monnet) writes:
> I'm trying to call a python script from my c++ code. All I need is to
> invoke the script and check the return status.
> does anyone has a simple example ? All I found until now is very
> complex and ugly code :-((
I think something like this will do (untested)
void runPythonFile(char* myfile)
FILE* fileptr = fopen(myfile, 'r');
int result = PyRun_SimpleFile(fileptr, myfile);
You should get some ideas by reading the Extending/Embedding section
in the python manual, and then read the relevant sections the Python/C api.
More information about the Python-list