[SciPy-user] Passing numpy array to a c function

Lou Pecora lou_boog2000@yahoo....
Sun Apr 20 16:13:34 CDT 2008


I think you have a typo.  See below:


--- Christopher Brown <c-b@asu.edu> wrote:

> Hi List,
> 
> I am trying to pass a numpy array of float64's to a
> c function, and I am 
> not having much luck. I have tried every example I
> could find, and based 
> on everything I have read, this seems (to me) like
> it should work. 
> Here's a minimal version of my function:
> 
> #include "Python.h"
> #include "Numeric/arrayobject.h"
> 
> PyObject* my_c_function(PyObject* self, PyObject*
> args) {
>    PyArrayObject *array;
>    int i;
>    if (!PyArg_ParseTuple(args, "O|i", &array, &i))
>      return NULL;


Shouldn't the format string be "O!i" ??   Not  "O|i".





-- Lou Pecora,   my views are my own.


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the SciPy-user mailing list