[Numpy-discussion] Using Numpy inside an application...

Karl Bellve Karl.Bellve at umassmed.edu
Tue Apr 3 10:30:45 CDT 2001

Since I can't search the web site, here is a question...

I am using the following calls inside my C++ app:

a=PyRun_SimpleString("from image_module import *"); // my module for
wrapping a C++ class
a=PyRun_SimpleString("image=imagemanager()\n");     // load a new
instance of the class into Python
a=PyRun_SimpleString("a=image.GetImage(0)");	    // assign image 0 to a

Basically, GetImage() returns a numpy Array Object for image 0, properly
initialized by PyArray_FromDimsAndData(). I can't return all the images
because they might not be sequential in memory (off loaded to the

"a" appears to be an list of numbers. I am not sure if Python knows it
is a PyArrayObject. This is where I am getting into trouble. I can't do
something like a=PyRun_SimpleString("a = a + 100"); I get an error
"Value Error: Function not Supported". 

I am trying to figure out what namespace did "import_array()" import
Numeric into.

Also, I am using _numpy_d.pyd that I compiled under Windows NT and MSVC


Karl Bellve, Ph.D.                   ICQ # 13956200
Biomedical Imaging Group             TLCA# 7938 		
University of Massachusetts
Email: Karl.Bellve at umassmed.edu
Phone: (508) 856-6514
Fax:   (508) 856-1840
PGP Public key: finger kdb at molmed.umassmed.edu

More information about the Numpy-discussion mailing list