PyRun_SimpleFile arguments

Tony Sideris tonys111 at
Wed Sep 20 14:19:43 CEST 2000

"yslee" <yslee at> 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( "", "r" )) == NULL )
>   printf( "The file '' was not opened (%d)\n", id);
>  else
>   printf( "The file '' was opened (%d)\n", id);
>  if (PyRun_SimpleFile(fp, "d:\\projects\\python\\test\\")!=0)
>   printf("PyRun_SimpleFile fails (%d)\n", id);
> Do I pass the right arguments to PyRun_SimpleFile?  The program crash at
> 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.


More information about the Python-list mailing list