Hello. I'm trying to embed a Py3.8 interpreter into a C++ application to
use as the "glue" for all the other components. We've come across some
complexities -- revolving around the use of frozen modules and multiple
interpreter states -- and I'm wondering if this is the correct list to seek
We can get a single interpreter running. We can add our stream objects and
capture the output, we can load our modules (giving the API access) into it
and generally everything seems fairly happy in single interp mode.
When we try and run a Py_NewInterpreter() to get us more interps to get
encapsulation between multiple scripts, it fails to launch (fails to get
filesystem's codec). The problem seems to be that the frozen modules added
to the launched interpreter are not cached after use. So the cloned
interpreter fails to start (it wants either an encoder search path which is
null for no filesystem OR to have the encodings module available). The
modules don't seem to be being cached because when the import runs them
with PyEval_EvalCode, they return nothing.
I suspect this is something I've missed about how to configure the original
interpreter, but documentation & use-examples for the new split-phase
initialisation are rather hard to find.
Cheers for any help you can provide,