[C++-sig] Type converter not found for property
Alex Leach
beamesleach at gmail.com
Wed May 8 23:31:14 CEST 2013
That error means the type_id of uuid is not in the bp registry.
I think you can fix this by deriving uuid_to_python from
to_python_converter, as demonstrated in the pytype_function example[1].
This will add the get_pytype function call, and on initialisation, should
hopefully add what's missing: a call to `registry::lookup`[2].
Cheers,
Alex
[1] -
http://www.boost.org/doc/libs/1_53_0/libs/python/doc/v2/pytype_function.html
[2] -
http://www.boost.org/doc/libs/1_53_0/boost/python/converter/registry.hpp
On Wed, 08 May 2013 21:33:51 +0100, Wichert Akkerman <wichert at wiggy.net>
wrote:
> I am trying to expose a class with a boost::uuids::uuid member to
> Python. The class is pretty simple:
>
> class Article {
> public:
> boost::uuids::uuid uuid;
> };
>
> which is exposed like this:
>
> article
> .def(init<boost::uuids::uuid, Article::Type>((arg("uuid")))
> .def_readwrite("uuid", &Article::uuid);
>
> and I have basic converter registered (see
> https://gist.github.com/wichert/5543390 , it is a bit large to include
> in >this email). This compiles fine and the uuid convertor works
> correctly when trying converting from python to C++, but >trying to
> access the uuid property results in "TypeError: No Python class
> registered for C++ class >boost::uuids::uuid". I don't understand why
> that doesn't work; does anyone see what I missed?
>
> Wichert.
>
>
--
Using Opera's mail client: http://www.opera.com/mail/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20130508/9b685f53/attachment.html>
More information about the Cplusplus-sig
mailing list