question about PyImport_ExecCodeModule and module import

D

Donnie Leen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,211
Messages
2,571,092
Members
47,693
Latest member
david4523

Latest Threads

Top