How to get python print result on jenkins console output

I have a Python script print line. Now that I ran it in Jenkins, I did not see the printed lines in the Jenkins Builds Console Output.

Anyway to achieve this?

+6
source share
2 answers

I believe you need to do flush , try:

 import sys sys.stdout.flush() 

This should help.

+2
source

Any output to stdout from a process created by Jenkins must be captured by console output. One caveat is that it won’t be displayed until a newline is printed, so make sure your lines are complete.

If you run python in some strange way that separates it from the Jenkins parent process, I can't help you.

+1
source

All Articles