En Sun, 01 Feb 2009 03:47:27 -0200, Deepak Chandran <dchandr...@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 is
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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to