Thanks pyscripter for the prompt response.
My use-case: the python code to be executed can return any one of a number of pre-defined result codes which in turn will determine the next action to take.
E.g.
function ExecPython(lines: TStrings): integer
....
begin
script_result := ExecPython(python_script);
case script_result of
0: Showmessage('All good');
101: Showmessage('Retry using some other setup');
102: Showmessage('Connection failed, please re-connect');
// etc
end;
end;
I was hoping for something as simple as my code sample where the integer return value can be checked; but I guess if we need to parse the output (Traceback, Exception.Message, etc) it could work.
I have access to the python code library; it will be possible to change the exception messages to something more "easily parse-able".
To be honest I was expecting something as simple as
PythonEngine1.LastResult;
I'll investigate the Traceback suggestion further.
Regards