PyRun_SimpleFile arguments

yslee yslee at vmstech.po.my
Tue Sep 19 23:01:00 EDT 2000


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





More information about the Python-list mailing list