Hii I am new to python and I would like to know how to update the output using the subprocess.Pope n() process. My problem is similar to real time updating of popen, bufsize=0 problems ... but the only variation is that, I would like to get the print statements from the python file like...
Ex:
File_Name.py
cmd ='python File_Name.py" '
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.Pope n(cmd,bufsize=0 ,stdout=subproc ess.PIPE, shell = True )
print "End of print statements..."
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
Ex:
File_Name.py
Code:
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.Pope n(cmd,bufsize=0 ,stdout=subproc ess.PIPE, shell = True )
Code:
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
Comment