problem with embbed boost.python in multi-interpreter and multi-thread HELP please

Donnie Leen Kingdom.Lin at yeah.net
Sun Dec 12 07:15:21 CET 2004


I wrote a program embbed boost.python, each thread running a sub-interpreter, i made a module implement by boost.python, and i wish this module imported in each sub-interpreter, i find that the module could initialize only once, otherwise the boost.python will throw a exception said that something already registered; second conversion method ignored.

So I try another way, initialize and import the module in one interpreter such as the main interpreter, and I hope to import the module in any sub-interpreter, because I found the python document said:
"Extension modules are shared between (sub-)interpreters as follows: the first time a particular extension is imported, it is initialized normally, and a (shallow) copy of its module's dictionary is squirreled away. When the same extension is imported by another (sub-)interpreter, a new module is initialized and filled with the contents of this copy; the extension's init function is not called. "
but when i try this way i found that the program throw an exception:ImportError: No module named mym, (mym is the module name). This happens even i wrote the module in Python/C API without boost.python.

Could somebody tell me why this happened or how to deal with it, thanks for any suggestion.

Donnie Leen





More information about the Python-list mailing list