Hi Stefan Rieger,
at first you have to distinguish between script error and process error. If you have a script error simply uncomment standard error handling lines in windows job and thats all:
python "path_to_script.py"
@set retcode=%errorlevel%
@if NOT %ERRORLEVEL% == 0 goto :retcode
If the returncode of the last command is not zero the job fail with ENDED_NOT_OK
If you get process errors from a python script you have to add some error handling to your script.
A simple python example with errorhandling:
import sys
try:
x=1/0
except ZeroDivisionError as err:
print('Handling run-time error:', err)
sys.exit(1)
After execution the %ERRORLEVEL% is not zero, so the job fail's
Notice that the script statemens must immediately follow the python call, otherwise your error is not passed to the automation engine. If you need to execute command's after your python call, you must handle it manually.
Hope that helps
Best Regards
Andrzej Golaszewski