This is a known problem, but I want to ask the experts for the best way to 
solve it for me.

I have a project (Euler Math Toolbox), which runs Python as a script language. 
For this, a library module "python.dll" is loaded at run time, which is linked 
against "python27.lib". Then Py_Initialize is called. This all works well.

But Euler can be restarted by the user with a new session and notebook. Then I 
want Python to clear all variables and imports. For this, I call Py_Finalize 
and unload "python.dll". When Python is needed, loading and initializing starts 
Python again.

This works. But Python crashes at the first call, if MatPlotlib is imported in 
the previous session. It seems that Py_Finalize does not completely clear 
Python, nor does unloading my "python.dll". I tried unloading "python27.dll" 
(the Python DLL), but this does not help. Most likey, another DLL remains 
active, but corrupts during Py_Finalize.

To solve this, it would suffice to clear all variables and imports. I could 
live with not calling Py_Finalize. But how?

PS: You may wonder, why I do not directly link euler.exe to Python. The reason 
is that this prevents Euler form starting, if Python is not installed, even if 
it is never needed.

Thanks for any answers! You duplicate your answer to renegrothmann at gmail, if 
you like. That would help me.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to