Hello everyone, I have a problem with the subprocess module. In fact I wish that when I run the command with subprocess I can retrieve the data immediately without waiting for the end of the command. I tried this way but ordering must end so that I can recover the data:
import subprocess, os, sys # Commande FFmpeg com_1 = 'ffmpeg -i /home/user/path/in.avi -s 160x120 -ac 1 -ar 22050 -qmin 3 -qmax 3 -y /home/user/path/out.avi' p = [subprocess.Popen(com_1, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True).communicate()[0]] for toto in p: ---->if '\r' in toto: -------->tampon = str(toto).split(' ') --------># ..., 'time=151.6', ... -------->for vb in tampon: ------------>if 'time' in vb: ---------------->tempsEcoule = vb[5:] ---------------->print u'Temps écoulé', tempsEcoule My version of Python: Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Can you help me?. Excuse me in advance for my bad English. a + -- http://ekd.tuxfamily.org _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor