[C++-sig] Abstract class instances to-python conversion

Simon Warg simwarg at gmail.com
Mon Aug 1 12:39:21 CEST 2011


You could use the reload() function in python 2.7 or imp.reload() in python 3. It takes a module object as argument.

// Simon

On 1 aug 2011, at 12:00, Valentin Perrelle <valentin.perrelle at orange.fr> wrote:

> 
>> All of that sounds sounds.  But at what point were you trying to register a to-python converter?  It sounded like you were trying to do that before importing the module, and since a to-python converter is by definition C++, I didn't understand how you could do it in a Python script before importing the module.
> 
> I'm registering the converter by calling the boost::python::import function in C++ code. I don't know any other way to do that.
> 
> Now, this give me another error. I'm trying to implement a "reload script" feature. I thought that all i had to do was to call Py_Finalize, then Py_Initialize again, and to remove any references i was holding to wrapping classes. But whenever i'm importing my extension again, i get the runtime error:
> 
> Assertion failed: slot->m_to_python == 0, file libs\python\src\converter\registry.cpp, line 212
> 
> which means my to_python converter have been registered once again. Is there a way to unregister them ? should i find a to not initialize the extension again ?
> 
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig


More information about the Cplusplus-sig mailing list