Ex:
File_Name.py
Expand|Select|Wrap|Line Numbers
- i=0
- while i <= 1000 :
- time.sleep(1)
- print "waiting for 1 second for the %s time"%i
- i=i+1
I have a python script which has this piece of code and would like to print it when i execute this file using:
ret = subprocess.Popen(cmd,bufsize=0,stdout=subprocess.P IPE, shell = True )
Expand|Select|Wrap|Line Numbers
- while True :
- line = OP.stdout.readline()
- if not line: break
- print line
I am unable to get the output of the script while running the script. (The whole data is being shown at once at the end of theexecution). Is there anyway to handle this situation..I tried the solution that has been referred earlier, but it works only for batch file not for script... :-(
Thanks in advance,
DecDon