Embedding (PyRun_SimpleFile)
nick_knight at my-deja.com
nick_knight at my-deja.com
Wed Aug 2 08:30:30 EDT 2000
I am trying to use the following code ( on a windows platform)
#include "Python.h"
#include "stdafx.h"
#include <stdio.h>
int main(int argc, char* argv[])
{
char *filename = "e:\\downloads\\python\\testbed\\test.py";
Py_Initialize(); //Required
FILE *OurFile = fopen(filename,"rb");
PyRun_SimpleFile(OurFile,filename);
//PyRun_SimpleString("print 'Hello'");
return 0;
}
- where thr file test.py contains
print "Hello"
every time I run the program ,
'import exceptions' failed; use -v for traceback
Warning! Falling back to string-based exceptions
'import site' failed; use -v for traceback
gets printed out to stdio, also when the program enters
PyRun_SimpleFile MSVC comes up with a unhandled exeption
Any thoughts would be appreciated
Thanks
Nick
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list