Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
print output on Jenkins
#1
I'm new to python, please help on this requirement.
I wrote a simple python script to execute on Jenkins pipeline.
calling bat script on Jenkins
bat 'test.py'
test.py has:
import os
cmd1 = my_command1
cmd2 = my_command2
print(cmd1)
os.system(cmd1)
print(cmd2)
os.system(cmd2)
output on Jenkins console:
Output:
cmd1 executes cmd2 executes print of cmd1 print of cmd2
Issue: print commands output shows always on end results. not an order write in a script.
maybe this basic question, Please help me.

I'm expecting result on Jenkins console is:
Output:
print of cmd1 cmd1 executes print of cmd2 cmd2 executes
Reply
#2
Python is probably buffering the I/O. If you're using Python 3, you can get around that by passing flush=True.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,076 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  How to output one value per request of the CSV and print it in another func? Student44 3 1,323 Nov-11-2022, 10:45 PM
Last Post: snippsat
  How to print the output of a defined function bshoushtarian 4 1,279 Sep-08-2022, 01:44 PM
Last Post: deanhystad
Sad Want to Save Print output in csv file Rasedul 5 10,909 Jan-11-2022, 07:04 PM
Last Post: snippsat
Photo print output none 3lnyn0 4 1,821 Nov-01-2021, 08:46 PM
Last Post: 3lnyn0
  output correction using print() function afefDXCTN 3 11,074 Sep-18-2021, 06:57 PM
Last Post: Sky_Mx
  print (output) taaperaban 3 1,921 Sep-03-2021, 04:23 PM
Last Post: deanhystad
  print function output wrong with strings. mposwal 5 3,109 Feb-12-2021, 09:04 AM
Last Post: DPaul
  Print output not working xninhox 7 4,034 Jan-16-2021, 09:42 AM
Last Post: xninhox
  Output with none, print(x) in function Vidar567 3 2,503 Nov-24-2020, 05:40 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020