[Numpy-discussion] Parsing PyArrays

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


Hi,
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){
    _import_array();
    PyArrayObject* A;
    PyArrayObject* B;
    if (!PyArg_ParseTuple(args, "O!O!", &PyArray_Type,&A, &PyArray_Type,&B))
        return;

    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