General questions about embedding Python.
amit at digitalpeers.com
Mon Jul 4 01:43:30 CEST 2005
I am currently studying how to embedd python. I am developing a
graphical C++ application. My goal is to embedd python script that will
control some kind of animation.
I have some questions about python embedding:
1) Is there a good text book or other resource on embedding/extending?
(I find it hard to learn only by the tutorial and C/Python API from the
2) I have found that there are many ways to embedd a script:
What are the cons and pros of using each of them?
3) Is there a problem with the PyRun_SimpleFile(). I am trying to run
the following code:
const char *SCRIPT_NAME = "C:\\test_script.py";
int _tmain(int argc, _TCHAR* argv)
script_file = fopen(SCRIPT_NAME, "r");
if (script_file != NULL)
The python script has only one line: 'print "hello"'
I build it with Python2.3 libraries. When I try to run the code I get
4) What is the correct way to handle/catch python exceptions in the
embedding Python code?
Forgive me if I have asked too many questions in one eMail, it is
becuase I don't really know where to start learning this subject from.
More information about the Python-list