[PyKDE] Importing sip-generated module into multiple interpreters

Nigel Stewart ns at fluent.com
Wed Aug 31 23:29:39 BST 2005


Hi,

I'm trying to encapsulate a script into
a seperate Python interpreter.  The idea
is that these scripts are safely
isolated from the rest of the system,
except for our sip-generated "module" API.

1    Py_BEGIN_ALLOW_THREADS

2    PyThreadState *pi =  Py_NewInterpreter();
3    initsip();
4    initmodule();
5    PyRun_SimpleString("...");
6    Py_EndInterpreter(pi);

7    Py_END_ALLOW_THREADS

I get the following error in response to line 4,
perhaps sip isn't designed to deal with multiple
interpreters?

RuntimeError: the sip module has already registered a module called icecore

Any info would be appreciated, especially if
there is another way to achieve a sandbox sharing
the same interpreter.

Regards,

Nigel Stewart




More information about the PyQt mailing list