472,127 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

Python embedded interpreter: how to initialize the interpreter ?

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 '06 #1
3 1838
At Sunday 31/12/2006 10:55, yc*****@freesurf.fr 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

Jan 2 '07 #2
the interpreter emits an error: tkinter module not defined

Capitalize the 't', in Tkinter, its case sensitive.

Jan 2 '07 #3
yc*****@freesurf.fr 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

Jan 3 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by vincent Salaun | last post: by
2 posts views Thread by Charlie DeTar | last post: by
reply views Thread by PixelDust1 | last post: by
34 posts views Thread by Ville Voipio | last post: by
5 posts views Thread by wahn | last post: by
reply views Thread by Simon Eves | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.