Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Inserting a dictionary of lists into '__main__' of an embeddedinterpreter

Reply
Thread Tools

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

 
 
quadric@primenet.com
Guest
Posts: n/a
 
      05-27-2005
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.








 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance ordered dictionary vs normal dictionary Navkirat Singh Python 6 07-29-2010 10:18 AM
inserting Unicode character in dictionary - Python gita ziabari Python 8 10-19-2008 06:34 PM
creating a dictionary from a dictionary with regex james_027 Python 1 08-22-2007 07:39 AM
List of lists of lists of lists... =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==?= Python 5 05-15-2006 11:47 AM
[DICTIONARY] - Copy dictionary entries to attributes Ilias Lazaridis Python 6 02-21-2006 11:27 AM



Advertisments