[C++-sig] Embedding and calling extended python commands

Stefan Seefeld seefeld at sympatico.ca
Fri Nov 30 16:44:31 CET 2007

Satyajit Sarangi wrote:

> C:\Python25>testpy test.py
> running file test.py...
> y:\private\my documents\ssarangi\my documents\visual studio
> 2005\projects\smallpython\smallpython\main.cpp(166): Python Error
> detected in function 'int __cdecl main(int,char **)'
> Traceback (most recent call last):
>   File "test.py", line 1, in <module>
>     import smallPython
> ImportError: __import__ not found
> 1 error detected.

This means you didn't initialize the embedded python interpreter
correctly. (You didn't include the code for that.)
The boost.python tutorial should tell you all you need. It has a special
section on Embedding. Also, you may want to look at the boost.python
tests exec.cpp and import_.cpp for inspiration.



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

More information about the Cplusplus-sig mailing list