search cancel

Python script output on Job Log only displayed at the end of the script


Article ID: 200639


Updated On:


CA Automic Workload Automation - Automation Engine CA Automic Dollar Universe CA Automic Applications Manager (AM)


When launching python scripts via a Jobs / Uproc / Interpreter, the python script output is not displayed on the Jobs Report / Uproc Job Log until the python script has finished its execution.


Any Scheduler / Environment using python scripts


Expected behavior, by default python buffers stdout and stderr streams until the end of the execution.

The option -u will allow to have the expected behavior:

-u     : force the stdout and stderr streams to be unbuffered;
         this option has no effect on stdin; also PYTHONUNBUFFERED=x


In order to be able to have the Job Log / Report updated in real-time while the python script is running, you need to add the option -u Invoke the python script via python -u

For example, this is the example of UC_EXT_INTERPRETERS_WINDOWS set on client 0 for Automic Workload Automation:

Please note that python.exe folder location SHOULD be available on the Windows PATH variable.

The same for Unix/Linux on UC_EXT_INTERPRETERS_UNIX