Boost logo

Boost :

From: Maciej Sobczak (prog_at_[hidden])
Date: 2004-03-25 09:59:42


Hi,

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 Boost.Python.

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"

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
converters?

Hacking the Boost.Python library is a valid option, but I would need at
least a suggestion where should I go.

Thank you very much for your time,

-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/

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