I'm new to python and now I need to call a python 2.7.6 program using its C API.
The python program is in the form of a python package and takes several command line options. You can run it like this:
python my_py_app input.txt --option1="value1" --option2="value2"
Here's what I've been doing:
1, Setup python API using Py_Initialize()
;
2, Load that package using PyImport_ImportModule("my_py_app")
and it returns a valid PyObject
3, I don't know how to proceed ...
The python C API document contains lots of functions like PyEval_CallXXX
. Which one do I need to call and how do I pass the option/value pairs to the program?