Import / export values to/from C program

Steffen Jahn stjahn at gmx.de
Tue Apr 13 16:47:51 EDT 2004


Hi,

I stumbled across Python when trying to invoke *scripts* from C programs. The 
idea is to set up some variables in the C program, export them, run a Python 
script, and, after completion, import some variables back into the C program.
This way, I can keep the C program very flexible for certain types of changes.

Unfortunately, I can't see an API to export/import an PyObject directly. 
I see currently only an indirect way: Implement import and export functions
in C which have to be called in the Python script (import function at 
beginning and export function at end). Though I would prefer a *direct* access.

At the moment, I start thinking whether direct access is really better since
the script needs anyways to *know* of the variables which are available (makes
not much difference whether variable or function...)

Anyways, maybe somebody can tell me if such direct access is possible. A kick 
in the right direction would be highly appreciated.

Thx, Steffen



More information about the Python-list mailing list