Embedding numpy works once, but not twice??
dchandran1 at tinkercell.com
Sun Feb 1 17:33:29 CET 2009
I sort of guessed that was the issue -- doing Py_Initialize/Py_Finalize more
than once. Thanks for the help.
On Sun, Feb 1, 2009 at 12:43 AM, Gabriel Genellina
<gagsl-py2 at yahoo.com.ar>wrote:
> En Sun, 01 Feb 2009 03:47:27 -0200, Deepak Chandran <
> dchandran1 at tinkercell.com> escribió:
> I have a program in which I have successfully embedded Python. Now, I want
>> to include NumPy as well (and other modules). I am able to import numpy
>> once. Then I close the python console in my program and then re-open it.
>> When I try to import numpy for a second time, the program crashes. Below
>> a simple version of the problem.
> The problem is not with NumPy. You can't run Py_Initialize/Py_Finalize more
> than once. Python doesn't have any mechanism to un-initialize loaded
> modules, and any static data that NumPy had initialized the first time it is
> imported becomes invalid the second time.
> Call Py_Initialize at the start of your program, and Py_Finalize at the
> end, never more than once.
> Gabriel Genellina
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list