Using the library in a Windows service. Is that possible ? #487
-
If I try to create an instance of TPythonEngine in a 64 bit Windows service, if the AutoLoad property is set to True the service does not start. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't know. But I don't see why not. However AutoLoad is relevant when using visual components in a form. You will have to create the components and load the dll manually. |
Beta Was this translation helpful? Give feedback.
-
When you run as a service the registry information is not available. You need to do something like: procedure TService1.CreatePyEngine; I have tested and it works. |
Beta Was this translation helpful? Give feedback.
When you run as a service the registry information is not available. You need to do something like:
procedure TService1.CreatePyEngine;
begin
PythonEngine := TPythonEngine.Create(nil);
PythonEngine.Name := 'PythonEngine';
PythonEngine.DLLName := 'python313.dll';
PythonEngine.DllPath := 'c:\pathtoyourpythonhome';
PythoneEngine.PythonHome := PythonEngine.DLLPath;
PythonEngine.RegVersion := '3.13';
PythonEngine.UseLastKnownVersion := False;
PythonEngine.FatalAbort := False;
PythonEngine.FatalMsgDlg := False;
PythonEngine.LoadDll;
end;
I have tested and it works.