Dennis Lee Bieber wrote: > On Tue, 29 Aug 2006 18:17:47 +0530, km <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > ######code start ###### > > import subprocess as sp > > x = 'GSQIPSHYWKKNLWYYSHEIDGGCHNMW' > > p0 = sp.Popen(["echo",x], stdout=sp.PIPE) > > Why use this at all? > > > p1 = sp.Popen(["fasta34","-q","@",s],stdin=p0.stdout, stdout=sp.PIPE) > > output = p1.communicate()[0] > > Just feed "x" to this directly... (untested): > > p1 = sp.Popen(["fasta34","-q","@",s],stdin=sp.PIPE, stdout=sp.PIPE) > output = p1.communicate(x)[0] > -- > Wulfraed Dennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ > (Bestiaria Support Staff: [EMAIL PROTECTED]) > HTTP://www.bestiaria.com/
You can also pass data to a subprocess like this: p1 = sp.Popen(["fasta34","-q","@",s],stdin=sp.PIPE, stdout=sp.PIPE) p1.stdin.write(x) p1.stdin.close() But I think communicate() would be better for you in this case. Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list