Py_Initialize() , use matplotlib , Py_Finalize() then Py_Initialize() , then matplotlib , it doesn't works and go wrong

---------------------------------- test.cpp: #include<Python.h> void test2() { // int b; Py_Initialize(); PyRun_SimpleString(“from matplotlib.pyplot import plotfile\n” “from pylab import show\n” “plotfile(‘/home/huskier/Desktop/data’)\n”//data file is just nums of 10 rows “show()\n”); Py_Finalize(); } int main(int argc,char *argv[]) { test2(); test2(); return 0; } ------------------------ How to work well?And the memory cann't free when use test2() in QT,if you plot many times at once.

Hello XingHua, this mailing list is about bugs/enhancements to Python documentation, but your email doesn't fall into this description. I'd suggest to contact a users support forum, such as http://mail.python.org/mailman/listinfo/python-list Regards, Sandro On Wed, Apr 11, 2012 at 16:45, XingHua Ma <aaqqxx1910@gmail.com> wrote:
----------------------------------
test.cpp:
#include<Python.h> void test2()
{ // int b; Py_Initialize(); PyRun_SimpleString(“from matplotlib.pyplot import plotfile\n” “from pylab import show\n” “plotfile(‘/home/huskier/Desktop/data’)\n”//data file is just nums of 10 rows “show()\n”); Py_Finalize(); }
int main(int argc,char *argv[]) { test2(); test2(); return 0; }
------------------------
How to work well?And the memory cann't free when use test2() in QT,if you plot many times at once.
_______________________________________________ docs mailing list docs@python.org http://mail.python.org/mailman/listinfo/docs
-- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi
participants (2)
-
Sandro Tosi
-
XingHua Ma