question about PyImport_ExecCodeModule and module import

Donnie Leen Kingdom.Lin at yeah.net
Mon Nov 22 02:06:14 EST 2004


I try to use PyImport_ExecCodeModule and some other function to import modules. I found that count reference of the return value of PyImport_ExecCodeModule is 2, if i don't need it any more i use Py_DECREF to reduce the reference it remains 1 and not be destroied, it stay in the memory even i don't neek it, why this happed?

Another question is how to import the module returned from PyImport_ExecCodeModule, i tried for many times and just find a way to import correctly: use PyRun_RunSimpleString( "import mymodulename" ), is there any better way to import it?

Thanks for any help.




Donnie Leen






More information about the Python-list mailing list