Boost logo

Boost :

Subject: [boost] Boost.Python sandox or multiple interpreters
From: David Bellot (david.bellot_at_[hidden])
Date: 2017-01-13 11:40:34


Hi,

I'm using Boost.Python to load and use plugins in Python. Each plugin can
define a few functions which are are pre-determined, so that my C++
software knows what to call.

However, the mistake I've made was to think that the Python interpreter
could be initialized many times, so that each plugins was existing and
running into a separate interpreter. It's of course not the case and
therefore, each time I load a new plugin, its functions overwrite the
functions of the same name from the previous plugin (the one which was
loaded just before), and so on.

Is there a possibility to either :

- have as many independent Python interpreters at the same time ?
- or encapsulate each plugin in an independent "environment" ?
- or any other solution which would elegantly solve this problem ? :-D

Thanks for your help,
David


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk