[C++-sig] Trouble converting data from numpy.array to c++

Andreas Kloeckner lists at informa.tiker.net
Tue May 11 17:46:28 CEST 2010


Hi Jean-Charles,

On Tue, 11 May 2010 11:32:08 +0200, QUILLET Jean-Charles <jean-charles.quillet at alyotech.fr> wrote:
> I've got this problem I cannot solve. I've a c++ application from which I create an array sending to python this string:
> 
> anArray = numpy.array((1, 2, 3))
> 
> After extracting the symbol "anArray" from the directory in a boost::python::object, I'm trying to extract the values in C++:
> 
> int val = bp::extract<int>(anArray[0]);
> 
> It doesn't work and raise the error:

This is probably not what you wanted to hear, but my PyUblas package
solves your problem. :)

http://mathema.tician.de/software/pyublas

HTH,
Andreas


More information about the Cplusplus-sig mailing list