PyRun_SimpleFile ?

Armin Samide armin.samide at avl.com
Thu Sep 6 06:57:01 EDT 2001


Hi,

i'am trying to start a python file out of c++ program by
PyRun_SimpleFile().
Looks like this:

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

void main (int argc, char **argv) { 
	
	Py_Initialize ();
	
	FILE *fp      = fopen ("test.py",   "r+");
	FILE *foxfile = fopen ("gltest.py", "r+");

	PyRun_SimpleFile (fp, "test.py");

	PyRun_SimpleFile (foxfile, "gltest.py");

	Py_Exit(0);
} 

The file test.py is executed without problem ( simply contains one
print statement ) but the file gltest makes use of the fox - python
binding.
If i start the file gltest.py from the command line ( python gltest.py
) everything is fine but out of that program i get:

Traceback (most recent call last):
  File "gltest.py", line 3, in ?
    from FXPy.fox import *
  File "E:\Programme\Python21\FXPy\__init__.py", line 4, in ?
    from fox import setErrorObject
  File "E:\Programme\Python21\FXPy\fox.py", line 2, in ?
    import foxc
ImportError: No module named foxc

Do I have to set up something extra, but the other file ( fox.py,
__init__.py ) are found and foxc.pyd also exists.

Is it possible to staticly include the fox part in thew python
interpreter and can you give me some tipps who to do that ?

thank a lot,
armin



More information about the Python-list mailing list