Newbie question: embedding python in a c++ main

Yishai Beeri yishai at platonix.com
Tue Jul 6 08:35:43 EDT 1999


Hello,

[If the answers to this questions are available in the python docs,
please direct me. I did not find direct answers there].

I am trying to embed the python interpreter in a c++ program. All it
does is a simple main, which initializes python, initializes several
python modules (extensions written in c++), and run a python program.

When I read the python program into a char* and use PyRun_SimpleString,
it seems to work fine. However, when I try to
use PyRun_SimpleFile, after opening the file, I get a crash somewhere
inside the PyParser functions.

Does anyone have a working example of what I'm trying to do? I suspect
the problem might lurk in c/c++ incompatibilities, but I'm not sure.

Thanks,
Yishai Beeri





More information about the Python-list mailing list