[C++-sig] embedded Python: Access an object defined previously in C++ (original) (raw)

Stefan Seefeld seefeld at sympatico.ca
Wed Dec 28 16:51:37 CET 2005


Markus Heller wrote:

Is it sufficient that the BOOSTPYTHONMODULE block stands just below all the other functions in the according cpp file?

I don't understand the question. What do you mean by 'all the other functions' ? The BOOST_PYTHON_MODULE block is used to export specific C++ types / functions to python, and tells the python module loader how to find them.

I want to call a Python script from within one of the functions of this class. This Python script will need to import the pipeline module. What are the necessare preconditions to allow the script to load my exported function?

Do I need to reset the PYTHONPATH variable? Does this variable need to point to where the binary is? Notabene, it is not a shared object...

That depends. When you want to load it as an ordinary python module, it has to be a shared object, and it must be in your PYTHONPATH. However:

HTH, Stefan



More information about the Cplusplus-sig mailing list