Executing a script.
Arinte
jamarijr at hotmail.com
Fri Dec 31 12:23:30 EST 1999
I am trying to run a .py file, but for some reason I keep getting a
null pointer exception??? I get this exception when I use PyRun_AnyFile
like so:
FILE* fname;
Py_Initialize();
fname = fopen(name,"r");
Py_InitModule("poss", Exposem);
cout<<Py_GetPath()<<endl;
if(fname!=NULL){
PyRun_AnyFile(fname,"Beer");
}
else
cout<<"File didn't open";
I changed it to use PyRun_SimpleString, and it worked fine. I figure I
could keep on using SimpleString, but I want to handle Python
exceptions, so I can do the traceback thing. So, that means I need to
use PyRun_String, but I don't understand what the parameters in it are
for? So, if no one can figure why I am getting the Null pointer trap
for PyRun_AnyFile, can I get some help on using PyRun_String? How bout
a quick synapses on getting exceptions in your c program too?
TIA
I am using NT 4.0 (sp 5) and MSVC 6.0 (sp3) if the makes a difference.
jamarijr at fakehotmail.com
erase the fake of course.
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list