From: David Abrahams (dave_at_[hidden])
Date: 2004-03-30 20:35:22
Maciej Sobczak <prog_at_[hidden]> writes:
> We (the shop where I try to promote Boost) are using Boost 1.30.2 and
> currently the main focus is on interpreter embedding with
> I've hit a hard problem with this library.
> For some reason, I would like to clean up the Python interpreter after
> performing some coputations with it and possibly reinitialize it
> later, if there is again a need to do some scripting.
> In other words, my use of Python interpreter is tightly scoped and
> there are repetitive calls to Py_Initialize() and Py_Finalize()
> functions during the lifetime of the application.
> The problem is that the initialization code that executes inside the
> BOOST_PYTHON_MODULE block (more specifically: the class_'s
> "definitions") throws when execituting for a second time:
> "trying to register to_python_converter for a type which already has a
> registered to_python_converter"
Right; re-starting Boost.Python isn't yet supported. Also,
Py_Finalize() isn't supported with Boost.Python at the moment. See
> This code is executed as a result of "from mymodule import *" Python
> command; the second execution is a result of running this command in
> the interpreter that was already finalized and RE-initialized.
> Is there a way to re-initialize the module without re-registering the
> Hacking the Boost.Python library is a valid option, but I would need
> at least a suggestion where should I go.
You should start by going to the c++-sig:
We can discuss further possibilities there.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk