Closed
Description
Hello, please tell me how to correctly run a ready-made .py file via Python4Delphi if the file itself requires launching with some parameters, for example -h -u -i -o for example, I would like to do something like:
function ExecPythonFile(const Filename,Params:string):string;
var
FGILState: PyGILstate_STATE;
begin
Result := '';
FGILState := PythonEngine.PyGILState_Ensure;
try
PythonEngine.ExecFile(Filename, params); //????
finally
PythonEngine.PyGILState_Release(FGILState);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
ExecPythonFile(ExtractFilePath(ParamStr(0))+'pyscript\main.py', ' --help');
end;
And usually I run this file like this:
python main.py --help