Peter Wuertz wrote: > Hi, > > I'm writing a C module for python, that accesses a special usb camera. > This module is supposed to provide python with data (alot of data). Then > SciPy is used to fit the data. >
Which version of scipy are you using? > My question is, how to make python read from a C array? By reading the > documentation, one could get the impression that PyBufferObjects do that > job. > > http://docs.python.org/api/bufferObjects.html > > It says: > "Two examples of objects that support the buffer interface are strings > and arrays." > > Where this function looks promising: > "PyBuffer_FromMemory - Return a new read-only buffer object that reads > from a specified location in memory, with a specified size." > > All right, lets imagine I created a PyBufferObject from my float array > in the C module, and passed it to python. How about creating an array directly from your float array using PyArray_SimpleNewFromData (the NumPy C-API) or PyArray_FromDimsAndData (the Numeric C-API). -Travis -- http://mail.python.org/mailman/listinfo/python-list