python - Feed string to the first Popen when several Popen are chained -


there answer how feed string popen using popen.communicate(intput=''). however, have problem of chaining several popen this:

p1 = popen(['fstcompile', '--isymbols=ascii.syms', '--osymbols=ascii.syms'], stdin=pipe, stdout=pipe) p2 = popen(['fstprint', '--isymbols=ascii.syms', '--osymbols=ascii.syms'], stdin=p1.stdout, stdout=pipe) p1.stdout.close() 

i feed string stdin p1 , execute whole sequence.

i tried following:

p1.stdin.write('xxxx') p1.stdin.flush() print p2.communicate()[0] 

and didn't work.

putting string p2.communicate()[0] makes no sense , didn't work anyway.

so what's right thing in such case?

thank in advance.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -