FAQ
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

Search Discussions

  • Mike Haspert at Sep 7, 2001 at 1:15 am
    It sound like your problem is something that happened to me. If you
    built your c++ program with a different version of the C runtime
    library than the Python interpreter was compiled with(for example your
    project is a debug build)you get import failures among other problems.
    See MSDN's Q190799 for starters
    Your choices are:
    1. Get the source for the python interpreter and evey module you'll be
    using, and do debug builds of all.

    2. Turn on debug information in a release build. You lose the use of
    ASSERT and leak reporting but can step through code.
    See MSDN's "Turn on generation of debug information for the release
    build"

    armin.samide at avl.com (Armin Samide) wrote in message news:<21691e22.0109060257.6237bfec at posting.google.com>...
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedSep 6, '01 at 10:57a
activeSep 7, '01 at 1:15a
posts2
users2
websitepython.org

2 users in discussion

Mike Haspert: 1 post Armin Samide: 1 post

People

Translate

site design / logo © 2022 Grokbase