PyRun_String using my module in a def
Alex Martelli
aleax at mac.com
Thu Jul 5 11:25:08 EDT 2007
Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:
> En Thu, 05 Jul 2007 01:19:32 -0300, Stuart <stuart.tett at gmail.com>
> escribió:
>
> > 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).
Yep.
> > 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.
Exactly.
Alex
More information about the Python-list
mailing list