From william.crocker at analog.com Thu Mar 23 07:13:18 2017 From: william.crocker at analog.com (Bill Crocker) Date: Thu, 23 Mar 2017 07:13:18 -0400 Subject: [C++-sig] I need to call Py_Finalize. Message-ID: <58D3ADCE.20509@analog.com> Hello: I searched the archive, but this subject did not appear... I have an "editing" app into which I have embedded python. This is really nice as it gives my users the ability to modify the "document" with a script as opposed to having to do it manually. My current implementation was done using SWIG, but I am considering porting it over to boost::python. The problem is that I want to wrap each invocation of a script with a Py_Initialize/Py_Finalize. I want this so that each invocation is guaranteed to run under the same circumstances. This works with SWIG, but does not work with boost::python (as advertised.) (If access to NumPy is the only reason that Py_Finalize can not be called, then access to NumPy should be optional because, in this case, the ability to call Py_Finalize is more important.) Should I: - Stick with SWIG. - Modify boost::python - Write my own stripped-down system based on boost::python. - Move to pybind11. - Wait a couple of days for an expert to modify boost::python to make the calling of Py_Finalize an option. :-) -- Bill