[C++-sig] Re: to_python (by-value) converter
Simon Ouellet
simon.ouellet at orthosoft.ca
Thu Sep 11 16:42:24 CEST 2003
I attached a complete reproducible test case.
The ouptut that I got is:
The following error occur in python converter:
================================================
TypeError: No to_python (by-value) converter found for C++ type: 3Foo
================================================
3
The following error occur in python interpreter:
================================================
Traceback (most recent call last):
File "<string>", line 4, in ?
NameError: name 'SomeFoo' is not defined
================================================
Thanks
On Wed, 2003-09-10 at 23:42, David Abrahams wrote:
> Simon Ouellet <simon.ouellet at orthosoft.ca> writes:
>
> > Hi,
> >
> > I'm using boost::python for embedding python into my application.
> >
> > I defined a module that containt a class_<Vector>.
> >
> > I can successfully instantiate a Vector in the embedded python but
> > I cannot create a python::object containing a Vector in C++
> >
> > Vector aVector;
> > python::object(aVector);
> > this statement gave me an error:
> >
> > TypeError: No to_python (by-value) converter found for C++ type:
> > N3Osm13MotionCapture6VectorE
> >
> >
> > Where N3Osm13MotionCapture6VectorE is my class Vector that has a default
> > copy constructor publicly available.
> >
> > What could be the problem? and what should I do to fix it?
>
> I can only guess that the C++ type "Vector" that you're wrapping below
> is not the same as Osm::MotionCapture::Vector, the type in the error
> message. Could you post a complete, reproducible test case?
>
> Did you base your code on the contents of the
> libs/python/test/embedding.cpp file?
>
> For what it's worth, this:
>
> > mGlobals["SomeVector"] = python::object(aVector);
> ^^^^^^^^^^^^^^^ ^
>
> is redundant.
>
> mGlobals["SomeVector"] = aVector;
>
> is equivalent.
>
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
--
_________________________________________________________
Simon Ouellet email: simon.ouellet at orthosoft.ca
Programmeur tel: 514-861-4074 #269
Orthosoft Inc. fax: 514-866-2197
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Embedded.cc
Type: text/x-c++
Size: 1868 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030911/458a3f0a/attachment.bin>
More information about the Cplusplus-sig
mailing list