Need help with PyRun_SimpleFile

Scott Shillcock shillcoc at
Sun Aug 29 08:46:33 CEST 1999


Here is my very simple program:

#include <iostream.h>
#include "Python.h"

main (int argc, char **argv) {

   Py_Initialize ();
   FILE *fp = fopen ("", "r+");
   cerr << "Before PyRun_SimpleFile" << endl;
   PyRun_SimpleFile (fp, "");
   cerr << "After PyRun_SimpleFile" << endl;

I can compile this into an exe file. I also created a very simple file that just prints one line of text. When I run my program it
crashes on the PyRun_SimpleFile() every time. I get the first cerr but
not the second.

What I am doing wrong? I have tried as many variations on this at I
could think of, all with the same result.


Scott Shillcock      shillcoc at
Reality by Design

More information about the Python-list mailing list