On 09/22/2011 04:31 PM, Jim Bosch wrote:
On 09/22/2011 09:43 AM, Wichert Akkerman wrote:
I am struggling to expose a map to python code. What I am doing is
pretty simple: I have a map from an enum type to Glib::ustring, with a
convertors registered to convert Python str and unicode instances to an
ustring, and ustring to Python unicode. I've put the relevant code below.

What I am running into is that the conversion from python to C++ types
is failing with a "No Python class registered for C++ class
Glib::ustring" error. This looks very similar to the FAQ entry "Why is
my automatic to-python conversion not being found?"
(http://www.boost.org/doc/libs/1_47_0/libs/python/doc/v2/faq.html#topythonconversionfailed
), and the workaround suggested there indeed works fine for class
properties. I can't seem to find a similar trick for map values though.
Is there a trick to get this working?


I think the easiest solution would be to try to switch to indexing suite v2 (I think the newest version is found in the Py++ sources, although you don't have to use Py++ to make use of it). With that, you can set the call policies for returning elements from your container.

Is http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/indexing_suite_v2/ the latest version of that? I'll give it a try.

wichert.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to