[C++-sig] Stuck on accessing numpy.ndarray in c extension

Hans Meine meine at informatik.uni-hamburg.de
Mon Sep 25 10:30:16 CEST 2006


On Monday, 25. September 2006 09:30, Qinfeng(Javen) Shi wrote:
> I used two ways to access numpy.ndarray, but they all reported error.
.. both ways look OK, but you only provided the raw functions, not the 
exporting code.  You should post the boost::python exporting code, too.

> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> Boost.Python.ArgumentError: Python argument types in
>     hello.testArray(numpy.ndarray)
> did not match C++ signature:
>     testArray(PyArrayObject*)
To me, that looks like a missing (lvalue) converter.

> SystemError: new style getargs format but argument is not a tuple
Are you using raw_function for the export?  Otherwise, it naturally expects a 
tuple "args" with the array as first member. -> hello.testArray((c,))

-- 
Ciao, /  /
     /--/
    /  / ANS



More information about the Cplusplus-sig mailing list