On 02/07/2010 05:22 AM, Murray Cumming wrote:
In Glom, to execute arbitrary Python code, I use PyRun_String() to parse
the Python code, PyDict_GetItemString() and PyObject_Call() to get a
callable object for that code, and then PyObject_CallObject() to
actually execute the code and get a return value. This was the result of
experimentation and code archeology:
http://git.gnome.org/browse/glom/tree/glom/python_embed/glom_python.cc?h=glom-1-12#n269

Is there anything in boost::python that wraps this, so I can make the
code nicer?

Yes. Please read the Boost.Python documentation, specifically on Embedding:
http://www.boost.org/doc/libs/1_42_0/libs/python/doc/tutorial/doc/html/python/embedding.html

    Stefan

--

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to