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

Discussion in 'Python' started by quadric@primenet.com, May 27, 2005.

  1. Guest

    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.
     
    , May 27, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marc Shapiro
    Replies:
    2
    Views:
    651
    Marc Shapiro
    Dec 19, 2003
  2. Amy G
    Replies:
    4
    Views:
    377
    Amy G
    Feb 3, 2004
  3. Hakan Nilsson
    Replies:
    1
    Views:
    317
    Mirko Zeibig
    Feb 3, 2004
  4. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    409
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  5. gita ziabari
    Replies:
    8
    Views:
    315
    Martin v. Löwis
    Oct 19, 2008
Loading...

Share This Page