En Fri, 07 Sep 2007 22:51:34 -0300, <[EMAIL PROTECTED]> escribi�: > problem is that the first time I press a key, it works, but after it > just print the keys I press, the annoying line being the one with > communicate, any idea of what is happening ? > > child1 = subprocess.Popen("/usr/bin/mplayer -slave -quiet - > idle",stdin=subprocess.PIPE,stdout=FNULL,stderr=FNULL,shell=True) > while 1: > ch=getkey() > name=os.listdir("/home/shivan/"+ch) > file_to_load = "/home/shivan/"+ch+"/"+name[0] > print "loadfile "+file_to_load > output, errors = child1.communicate("loadfile "+file_to_load+" > \n")
communicate sends its input and waits until the process finishes, collecting all output. So it's not adequate for your needs. You should write directly to child1.stdin: child1.stdin.write("loadfile "+file_to_load+" \n") -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list