Loading and Unloading Python DLLs #434
Unanswered
ianmackers
asked this question in
Q&A
Replies: 1 comment
-
See Demo34, #287 and https://en.delphipraxis.net/topic/7721-if-i-changed-the-p4d-dllpath-how-to-reload-dlls |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am writing a python script manager that needs to load/unload different python DLLs and virtual environments.
Doing a simple thing like PythonEngine.LoadDLL, UnloadDLL and then again LoadDLL gives me the "'There is already one instance of TPythonEngine running".
The only way I can get this to work is to add the "gPythonEngine := nil" line below into the following procuedure:
procedure TDynamicDll.UnloadDll;
begin
if IsHandleValid then begin
BeforeUnload;
FreeLibrary(FDLLHandle);
FDLLHandle := 0;
gPythonEngine := nil
--> Added this lineend;
end;
IS this a bug or am I going about the process incorrectly?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions