[Numpy-discussion] Parsing PyArrays

Babak Ahmadi kackvogel@googlemail....
Wed Sep 1 11:07:21 CDT 2010

I'm having a little Problem that might be trivial.
I'm trying to use a nupmy array within a c++ method and having some trouble.
The PyArray is not parsed correctly and PyArg_ParseTuple returns 0.
Appreciate any help.

#include "Python.h"
#include <numpy/arrayobject.h>

void fromMatrix(PyObject *args){
    PyArrayObject* A;
    PyArrayObject* B;
    if (!PyArg_ParseTuple(args, "O!O!", &PyArray_Type,&A, &PyArray_Type,&B))

    int m = PyArray_DIM(A,0);
    int n = PyArray_DIM(A,1);

.... and so on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100901/ff83363a/attachment.html 

More information about the NumPy-Discussion mailing list