A question?

Ignacio Vazquez-Abrams ignacio at openservices.net
Sun Sep 9 01:28:30 CEST 2001

On Sat, 8 Sep 2001, vin wrote:

> PyImport_GetModuleDict()  which is the same as sys.modules and which
> returns a dictionary already contains 'exmpl'
> To see that just insert
>   PyRun_SimpleString("import sys\n");
>   PyRun_SimpleString("print sys.modules\n");
> after
>   module=PyImport_ImportModule("exmpl");
> Therefore inserting 'exmpl' module doesn't help.

Huh. Okay...

Ah, I think I have it.

Use PyEval_GetGlobals() to get a borrowed reference to the global dictionary
and use PyDict_SetItemString() to set it, or you can just use
PyModule_GetDict() to get the module's dictionary, then use PyDict_Keys().

Ignacio Vazquez-Abrams  <ignacio at openservices.net>

More information about the Python-list mailing list