to Philip Austin:Re: Stuck on accessing numpy.ndarray in c extension
Hi Philip Austin, Thanks! I added following lines as you told me to hello.cpp file. It didn't crash but still had error. The interesting thing is that now running it twice would get two different error informations. /************hello.cpp**************/ namespace ar=boost::python::numeric; namespace bp=boost::python; import_array(); ar::array::set_module_and_type("numpy", "ndarray"); ########## error report##########
import hello import numpy a = numpy.arange(25).reshape((5,5)); hello.testArray(a) // first time SystemError: new style getargs format but argument is not a tuple hello.testArray(a) // second time args is array type! //it means PyArray_Check(args) successed this time. getting input failed! //PyArg_ParseTuple() failed but not crashed
Any idea? -- Qinfeng(Javen) Shi Research School of Information Sciences and Engineering Australian National University Locked Bag 8001 Canberra ACT 2601
participants (1)
-
Qinfeng(Javen) Shi