Have found and read the "Extending and Embedding the Python Interpreter"
doc but have found it to be skimpy and confusing. Perhaps an example or two
would help. The demo.c just ran commands and did not allow C to
access any results.
I am in need of accessing a Python structure that is created in embedded
Python and then using in C/C++. This particular application will perform
interactive drawing and build network interfaces based on the Python
system configuration list and lots of other interfaces.
Would offer to write a cookbook for embedded Python when I figure it out.
Suppose the following Python script exists:
-------
class Junk:
..... # hairy stuff...
global answer
answer = Junk(...) + hairy.stuff() + ...
-----------
I want my program to get whatever "answer" is.
Something like:
answer__in_c = (object *)get_python_value("answer");
I *don't* want values just this printed out as the script is run for the benefit of
the C code (that's what embedded python is about). As a log file operation
the printing may be useful, but must be switch selectable.
Likewise: answer_in_c = (object *)get_python_value("stuff.fcn(xyz)");
should evaluate the quoted string and return whatever that is.
While I am still a beginner in Python, I like it a lot, but our requirements
are to use it as an embedded scripting language.
Any tips/hints gurus?
- cecil
-------------------------------------------------------------------------------- Cecil McGregor |\/\/\/| Tandem Corp, MS 3-06 | |