PyRun_SimpleFile arguments
Tony Sideris
tonys111 at erols.com
Wed Sep 20 08:19:43 EDT 2000
"yslee" <yslee at vmstech.po.my> wrote in message
news:005c01c022af$01c060e0$1d76e4c0 at sweetysl...
> I'm trying to embed the Python interpreter in my C++ application, I do
> something like this in my code :
>
> Py_Initialize();
> FILE* fp;
>
> if( (fp = fopen( "test.py", "r" )) == NULL )
> printf( "The file 'test.py' was not opened (%d)\n", id);
> else
> printf( "The file 'test.py' was opened (%d)\n", id);
> if (PyRun_SimpleFile(fp, "d:\\projects\\python\\test\\test.py")!=0)
> printf("PyRun_SimpleFile fails (%d)\n", id);
>
> Do I pass the right arguments to PyRun_SimpleFile? The program crash at
the
> statement where I call it.
>
> YS Lee
> Software Developer
> VMS Technology Sdn Bhd
>
>
Looks OK, I'm guessing you're using MSVC++? You must change the runtime
library for your project to use the same runtime library Python uses.
Project->Settings->C/C++->Runtime Library. If I remember correctly the
properly library is Multithreaded DLL.
-Tony
More information about the Python-list
mailing list