pyscripter / python4delphi

Free components that wrap up Python into Delphi and Lazarus (FPC)
MIT License
895 stars 307 forks source link

Running python code in Delphi threads issue #458

Closed KhurshedUlugov closed 6 months ago

KhurshedUlugov commented 6 months ago

It's a continuation of a theme #457

Unfortunately, nothing works. None of the methods given in the article (https://github.com/pyscripter/python4delphi/wiki/PythonThreads#tpythonthread-properties). There is simply no response. I have logging, but nothing is written in the log.

What am I doing wrong? Python embedded version is 3.8. Delphi 11.3

Here is my code:

    ThreadPythonExec(
    procedure
    begin
      GetPythonEngine.ExecFile(PyFileName);
    end{, nil, false, emNewInterpreter});

    Task := TTask.Create(
        procedure
        var
          Py: IPyEngineAndGIL;
        begin
          Py := SafePyEngine;
          Py.PythonEngine.ExecFile(PyFileName);
        end);
    Task.Start;
pyscripter commented 6 months ago

Please continue at the previous issue. Do not open a new one.