A question?
Ignacio Vazquez-Abrams
ignacio at openservices.net
Sat Sep 8 17:19:23 EDT 2001
On Sat, 8 Sep 2001, vin wrote:
> Gven a file exmpl.py
>
> def foo(x,y):
> return x,y;
>
> Why does the following ....
>
> module=PyImport_ImportModule("exmpl");
> PyRun_SimpleString("print dir(exmpl)\n");
>
> give ....
>
> Traceback (most recent call last):
> File "<string>", line 1, in ?
> NameError: name 'exmpl' is not defined
You have to put this line between the two:
PyDict_SetItemString(PyModule_GetModuleDict(), "exmpl", module);
--
Ignacio Vazquez-Abrams <ignacio at openservices.net>
More information about the Python-list
mailing list