PyRun_SimpleFile arguments

yslee yslee at vmstech.po.my
Wed Sep 20 08:48:26 EDT 2000


This is caused by the MSVC /MD compiler setting, originally my setting is
/ML.  I got the answer from the Python FAQ, sorry for not referring to it
first.

YS Lee

----- Original Message -----
From: "yslee" <yslee at vmstech.po.my>
To: <python-list at python.org>
Sent: Wednesday, September 20, 2000 11:01 AM
Subject: PyRun_SimpleFile arguments


> 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