Problem embedding Python.

Brandon Keown keown.brandon at gmail.com
Tue Oct 27 07:25:54 CET 2009


I am going to try to embed python in an application, but in simple
testing, I could not get it to work.  The following code seems like it
should work, but it crashes, and I have tried several things.  What
could I be doing wrong?

#include <Python.h>

int main(int argc, char* argv[])
{
	FILE* fp = fopen("test.py","r");
	Py_Initialize();
	PyRun_SimpleFile(fp,"test.py");
	Py_Finalize();
	return 0;
}



More information about the Python-list mailing list