Skip to content

Using the library in a Windows service. Is that possible ? #487

Answered by pyscripter
lucapretti asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@lucapretti
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by pyscripter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants