[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
- Previous message: [C++-sig] embedded Python: Access an object defined previously in C++
- Next message: [C++-sig] embedded Python: Access an object defined previously in C++
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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:
you may adjust your PYTHONPATH programmatically just before loading the module
you may be able to register the python module programmatically such that the loader isn't involved at all, i.e. the module doesn't need to be in a DSO. I have never done that myself, though, so I can't give any specific advice. Some experimentation may be necessary.
HTH, Stefan
- Previous message: [C++-sig] embedded Python: Access an object defined previously in C++
- Next message: [C++-sig] embedded Python: Access an object defined previously in C++
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]