473,385 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Inserting a dictionary of lists into '__main__' of an embeddedinterpreter

Hi,

I have an application that has an embedded interpreter. This application
loads many
DLL's and passes a PyObject * to each DLL that was gotten from the
following call:

PyObject * pmod = PyImport_AddModule("__main__") ;
Later, in one of the many DLL's that interact with the embedded
interpreter, I attempt to insert
a dictionary of lists into the module represented by the pointer
'pmod' passed to the DLL from the
main application.

The dictionary of lists is created with the following call:

PyObject * abm_dict = Py_BuildValue( "{s:O,s:O,s:O,s:O,s:O,s:O,s:O,s:O,s:O}" ,
"i_list" , i_list , "l_list" , l_list ,
"bpl_list" , bpl_list,
"rt_list"
, rt_list , "st_list" ,st_list , "u2_list" , u2_list ,
"t_list"
, t_list ,"ot_list" , ot_list , "plt_list" , plt_list
);

where each item following a quoted string is a PyObject * created by
another Py_BuildValue statement.

After building 'abm_dict' , I attempt to insert it into the embedded
interpreter with the following call:

PyModule_AddObject( pmod , "abm_dict" , abm_dict );

The application crashes at this point.

Being a bit new to embedded Python, I don't readily see what I'm doing
wrong. Could one of you more
experienced guys save me a whole lot of time and point out the obvious to me?

Thanks for your help.


Jul 19 '05 #1
0 1008

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: none | last post by:
or is it just me? I am having a problem with using a dictionary as an attribute of a class. This happens in python 1.5.2 and 2.2.2 which I am accessing through pythonwin builds 150 and 148...
3
by: Blair Hall | last post by:
I would like to determine whether two dictionaries have the same set of keys. Can anyone tell me if I HAVE to sort the key sequences as in this code snippet: # d1, d2 already created k1 =...
6
by: Jesper Olsen | last post by:
Does python have a way of defining a dictionary default? I think not, but are there any plans to incorporate it? Intuitively I would imagine that a={} a.set_default(my_default) would do...
5
by: Michael Foord | last post by:
I use a module called COnfigObj to read my config files into python. It exposes them as a dictionary. I often find myself writing code like : valuelist = config = ConfigObj(filename,...
7
by: rickle | last post by:
I'm trying to compare sun patch levels on a server to those of what sun is recommending. For those that aren't familiar with sun patch numbering here is a quick run down. A patch number shows...
11
by: Girish Sahani | last post by:
I wrote the following code to concatenate every 2 keys of a dictionary and their corresponding values. e.g if i have tiDict1 = tiDict1 = {'a':,'b':} i should get tiDict2={'ab':} and similarly for...
14
by: vatamane | last post by:
This has been bothering me for a while. Just want to find out if it just me or perhaps others have thought of this too: Why shouldn't the keyset of a dictionary be represented as a set instead of a...
16
by: Michael M. | last post by:
How to find the longst element list of lists? I think, there should be an easier way then this: s1 = s2 = s3 = if len(s1) >= len(s2) and len(s1) >= len(s3): sx1=s1 ## s1 ist längster
7
by: mmm | last post by:
I found code to undo a dictionary association. def undict(dd, name_space=globals()): for key, value in dd.items(): exec "%s = %s" % (key, repr(value)) in name_space So if i run I get
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.