<html><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-15"><META name="Author" content="Novell GroupWise WebAccess"></head><body style='font-family: Tahoma, sans-serif; font-size: 13px; '>Hi Jean-Charles,<br><br>AFAIK there are no standard converters for the numpy scalar types to C++ types.<br>In pyrap it is solved by having explicit converters for numpy scalar types to C++ types (see pyrap.googlecode.com).<br><br>Cheers,<br>Ger<br><br>>>> QUILLET Jean-Charles <jean-charles.quillet@alyotech.fr> 05/11/10 11:38 AM >>><br>
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Texte brut Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.TextebrutCar
        {mso-style-name:"Texte brut Car";
        mso-style-priority:99;
        mso-style-link:"Texte brut";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've got this problem I cannot solve. I've a c++ application
from which I create an array sending to python this string:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">anArray = numpy.array((1, 2, 3))<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">After extracting the symbol "anArray" from the
directory in a boost::python::object, I'm trying to extract the values in C++:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">int val = bp::extract<int>(anArray[0]);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It doesn't work and raise the error:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoPlainText">"TypeError: No registered converter was able to
produce a C++ rvalue of type int from this Python object of type numpy.int32"<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">What is going on ? I'm using python 2.6, last version of
Numpy 1.4.1 with boost 1.38 on Linux. Looking on the list, it seems that
someone had this very problem but he didn't get any answer. <o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">http://article.gmane.org/gmane.comp.python.c++/11279/match=typeerror+no+registered+converter+able+produce+c%2b%2b+rvalue+type+int+python+object+numpy+int32<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Hopefully I'll have more chance !<o:p></o:p></p>
<p class="MsoPlainText">Any idea greatly appreciated,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Jean-Charles<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</jean-charles.quillet@alyotech.fr></body></html>