PyRun_String using my module in a def

Gabriel Genellina gagsl-py2 at
Thu Jul 5 09:54:34 CEST 2007

En Thu, 05 Jul 2007 01:19:32 -0300, Stuart <stuart.tett at>  

> What command do you mean when you say "update main_dict with
> dlfl_dict"?

I think Alex Martelly was refering to use main_dict.update(dlfl_dict)  
(Python code) or PyDict_Update(main_dict, dlfl_dict) (in C code).

> I tried PyObject *rstring = PyRun_String( cmd, Py_file_input,
> dlfl_dict, dlfl_dict );
> This worked, but has the side effect of not allowing other commands
> like "execfile"

The idea is to copy all items from dlfl_dict into main_dict, and use  
main_dict for both globals and locals.

Gabriel Genellina

More information about the Python-list mailing list