Py_initialize / Py_Finalize not working twice with numpy Py_initialize / Py_Finalize not working twice with numpy numpy numpy

Py_initialize / Py_Finalize not working twice with numpy


From the Py_Finalize docs:

Some extensions may not work properly if their initialization routine is called more than once; this can happen if an application calls Py_Initialize() and Py_Finalize() more than once.

Apparently Numpy is one of those. See also this message from Numpy-discussion.

Calling Py_Initialize() only once, and cleaning up at exit, is the way to go. (And it's should be faster, too!)


I have this in my module initialization part, but the URL does not exist anymore. In case it helps:

// http://numpy.scipy.org/numpydoc/numpy-13.html mentions this must be done in module init, otherwise we will crashimport_array();