473,509 Members | 2,946 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1967
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1980
by: vincent Salaun | last post by:
hi all, here's my problem : I've embedded a python interpreter in our java application (based on the NetBeans palteforrm) using the Jython API : http://www.jython.org/docs/javadoc/index.html...
0
1372
by: Gregory Lielens | last post by:
Hello all, I am not sure this is the correct list to ask as my problem is really related to python low level implementation, but as I do not have found a python.dev list, here it is :-) We...
2
1863
by: Charlie DeTar | last post by:
So, I have an amazing, functioning foobar class that embeds python. Only trouble is, I want to be able to have multiple foobar objects at once, each with their own interpreters, stdouts, and...
1
2897
by: Donnie Leen | last post by:
I wrote a program embbed boost.python, each thread running a sub-interpreter, i made a module implement by boost.python, and i wish this module imported in each sub-interpreter, i find that the...
0
1046
by: PixelDust1 | last post by:
Hi guys, I am pretty new to Python and to embedding it in C. Here is what I am trying to accomplish: I have a C program that accepts user input, which can be a Python script which includes...
34
6360
by: Ville Voipio | last post by:
I would need to make some high-reliability software running on Linux in an embedded system. Performance (or lack of it) is not an issue, reliability is. The piece of software is rather simple,...
5
3202
by: wahn | last post by:
Hi, Here is a problem I came across and need some help with. I developed a little Python script with some classes which runs standalone and communicates with a database via sockets. So far...
0
1190
by: Simon Eves | last post by:
I am trying to write a Python module to embed the functionality of Maya (the 3D modelling and animation application from Autodesk, formerly Alias) for doing scripted scene manipulation and...
4
2813
by: Chris8Boyd | last post by:
I am embedding Python in a MSVC++ (2005) application. The application creates some environment and then launches a Python script that will call some functions exported from the MSVC++ application....
0
7234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7344
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7412
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
441
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.