Python embedded interpreter: how to initialize the interpreter ?

Discussion in 'Python' started by ycollet@freesurf.fr, Dec 31, 2006.

  1. Guest

    Hello,

    I've written a C embedded application. I want to open a python gui
    application in my C program but when I do :

    PyRun_String( "import gui.py", file_input, pDictionary, pDictionary );

    the interpreter emits an error: tkinter module not defined

    What script must I load to initialize the embedded python interpreter
    so as I have the same modules in the python command line and in the
    python embedded interpreter ? /usr/lib/python2.4/*.py ??

    Yann COLLETTE
     
    , Dec 31, 2006
    #1
    1. Advertising

  2. At Sunday 31/12/2006 10:55, wrote:

    >I've written a C embedded application. I want to open a python gui
    >application in my C program but when I do :
    >
    >PyRun_String( "import gui.py", file_input, pDictionary, pDictionary );
    >
    >the interpreter emits an error: tkinter module not defined


    Does it work if you try it from the interpreter?


    --
    Gabriel Genellina
    Softlab SRL






    __________________________________________________
    Preguntá. Respondé. Descubrí.
    Todo lo que querías saber, y lo que ni imaginabas,
    está en Yahoo! Respuestas (Beta).
    ¡Probalo ya!
    http://www.yahoo.com.ar/respuestas
     
    Gabriel Genellina, Jan 2, 2007
    #2
    1. Advertising

  3. Guest

    > >the interpreter emits an error: tkinter module not defined

    Capitalize the 't', in Tkinter, its case sensitive.
     
    , Jan 2, 2007
    #3
  4. wrote:
    > Hello,
    >
    > I've written a C embedded application. I want to open a python gui
    > application in my C program but when I do :
    >
    > PyRun_String( "import gui.py", file_input, pDictionary, pDictionary );
    >
    > the interpreter emits an error: tkinter module not defined
    >
    > What script must I load to initialize the embedded python interpreter
    > so as I have the same modules in the python command line and in the
    > python embedded interpreter ? /usr/lib/python2.4/*.py ??
    >
    > Yann COLLETTE


    Did you call the Py_Initialize() function before trying to execute that
    statement? Note also that you might have to Py_SetProgramName(somepath)
    before calling Py_Initialize(). See the documentation for details:
    http://docs.python.org/ext/embedding.html
    http://docs.python.org/api/embedding.html

    Hope this helps,
    Ziga
     
    Ziga Seilnacht, Jan 3, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charlie DeTar

    embedded python and interpreter threads

    Charlie DeTar, Dec 7, 2004, in forum: Python
    Replies:
    2
    Views:
    665
    Charlie DeTar
    Dec 7, 2004
  2. Peter Newman
    Replies:
    1
    Views:
    439
  3. Replies:
    4
    Views:
    588
  4. Chirag Mistry
    Replies:
    1
    Views:
    323
    Rick DeNatale
    Mar 10, 2008
  5. shooshx
    Replies:
    2
    Views:
    321
Loading...

Share This Page