[Python-Dev] embedding python with numarray
Guido van Rossum
guido at python.org
Thu Mar 25 10:41:26 EST 2004
> Using Python 2.3.3,
> trying to embed python with numarray,
> my C++ application crashes (segmentation fault) at "import_libnumarray()",
> (I c&p the macro, its within the macro at:
> PyObject *module =
> PyImport_ImportModule("numarray.libnumarray");
> )
>
> when I:
>
> 1.
> initalize python and numarray like:
> ...
> Py_Initialize();
> import_libnumarray();
> ...
>
> 2 .
> load another module like:
>
> PyObject* pModule = PyImport_Import(pName);
>
>
> 3.
> call Py_Finalize()
> and do 1. again.
>
> The palce where it crashes is:
> Objects/typeobject.c
> line 3004:
> if (basebase->tp_as_sequence == NULL)
>
>
> If I call import_libnumarray() only once (ie calling Py_Initialize()
> without import_libnumarray() the second time,
> I cannot use numarray:
>
> Traceback (most recent call last):
> File "/usr/local/gdl/gdl/test.py", line 5, in testfun
> print a
> File
> "/usr/local/lib/python2.3/site-packages/numarray/numarraycore.py", line
> 660, in __str__
> return array_str(self)
> TypeError: 'NoneType' object is not callable
>
>
> Any suggestions?
> How can numarray be restarted properly after a Py_Finalize() ?
This seems to be a numarray problem. I don't have the numarray source
handy; I suggest that you bring this under the attention of the
numarray developers. If they can't figure out what they need to fix
we're here to help.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list