By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

access ndarray on python side

P: 1
A previously closed question at

export an array of floats to python

concludes with sturlamolden saying, "Now return myarray and be happy." and Peter Wuertz saying, "Thank you! Thats the complete solution *g*"

This is all good. But I am stuck on the python side where I want to see the array.

I have a c shared library function like
Expand|Select|Wrap|Line Numbers
  1. PyObject *theArray(void)
  2. {
  3.     return PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE, void* data);
  4. }
On the python side I load this library and get this pointer
Expand|Select|Wrap|Line Numbers
  1. thing = mylib.theArray
  2. print thing
thing looks like a _FuncPtr object. What I can't find (bad googler I guess) is a simple example of seeing or indexing the array elements in my python script. Can anyone show or ref python code that shows how the array is accessed?
Aug 22 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.