Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Python embedded interpreter: how to initialize the interpreter ? (http://www.velocityreviews.com/forums/t397789-python-embedded-interpreter-how-to-initialize-the-interpreter.html)

ycollet@freesurf.fr 12-31-2006 01:55 PM

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


Gabriel Genellina 01-02-2007 03:42 PM

Re: Python embedded interpreter: how to initialize the interpreter ?
 
At Sunday 31/12/2006 10:55, ycollet@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


brent.chambers@gmail.com 01-02-2007 07:33 PM

Re: Python embedded interpreter: how to initialize the interpreter ?
 
> >the interpreter emits an error: tkinter module not defined

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


Ziga Seilnacht 01-03-2007 01:00 AM

Re: Python embedded interpreter: how to initialize the interpreter ?
 
ycollet@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



All times are GMT. The time now is 07:34 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.