[C++-sig] Problem using the ptr() function

Emmanuel Taurel etaurel at cells.es
Mon Nov 7 18:11:19 CET 2005

Hello everybody,

As requested by Dave, I have reduced my example as far as I can.
Sorry for the very, very long response time....

I recall my problem: I have a C++ class called Device. In the Python world,
I create a class inheriting from this C++ class (called MyDevice) and I
create one python method in this new class which is called "a_new_method".
This python method receives one parameter of a type for which I have
installed Boost converter. The type is called "MyStrArray"
The Python code creates one instance of the MyDevice class and call its C++
method called "execute_device_method". This C++ method callback the new
"a_new_method" python code with the help of the Boost call_method()
If, when calling back the new Python method, I am using the Boost ptr()
Function, I have a run-time error:

Traceback (most recent call last):
  File "main.py", line 13, in ?
TypeError: No Python class registered for C++ class std::vector<std::string,
std::allocator<std::string> >

If I don't use the Boost ptr() function, everything works fine and the
"a_new_method" Python method is executed correctly.

I have added to this file two files which are the Python and the C++ code.

Thank's for your help


Emmanuel Taurel (etaurel at cells.es)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.py
Type: application/octet-stream
Size: 299 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20051107/830d8d9a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py_ds.cpp
Type: application/octet-stream
Size: 3036 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20051107/830d8d9a/attachment-0001.obj>

More information about the Cplusplus-sig mailing list