[Numpy-discussion] Re: Mcmillan installer and numarray

Russell E. Owen rowen at cesmail.net
Fri Jun 24 16:16:38 EDT 2005


In article <20050624172101.15138.qmail at web50610.mail.yahoo.com>,
 Stefan Kuzminski <pontifor at yahoo.com> wrote:

> Hi,
> 
> I have for a long time successfully rolled up stand alone executables
> that use Numeric, now I'm trying to move over to numarray, but am
> getting the following error.
> 
> "Fatal Python error: Call to API function without first calling
> import libnumarray() in Src  convmodule.c"
> 
> Now I recall that numeric had this extra initializing call for the C
> code, and I suppose numarray does as well.  Can someone give me some
> guidance on how to explicity call that initialization function from
> Python?

The numarry docs include a good tutorial for writing C extensions ("C 
Extension API"). Based on that, near the top of my C numarray 
extension's header file I have:

#include "Python.h"
#include "libnumarray.h"

...and the bottom of my .c file is...

// Module initialization function
void initradProf(void) {
    PyObject *m;
    m = Py_InitModule3("radProf", radProfMethods, radProfModule_doc);
    
    if (m == NULL)
        return;

    import_libnumarray();
}

...and I guess distutils finds initradProf based on the setup.py file





More information about the NumPy-Discussion mailing list