-1

I have two executable e.g A.exe, B.exe. Is it possible with python subprocess popen to the two executable communicate each other through stdin/stdout:

A = Popen("A.exe",...,stdin=B.stdout, stdout=PIPE)
B = Popen("B.exe",...,stdin=A.stdout, stdout=PIPE) ?

(where A.exe contains print/scanf pairs, and B.exe the scanf/printfs.)

Istvan Nagy
  • 33
  • 1
  • 4
  • Not sure what you are asking, although `pexpect` and have both run and do whatever you wish to put from one to another ? – han solo Feb 18 '19 at 12:58
  • Seems to be a duplicate of https://stackoverflow.com/questions/4846891/python-piping-output-between-two-subprocesses – Michael Veksler Feb 18 '19 at 14:31

1 Answers1

0

try Popen.communicate it takes a parameter input with the text to send to a subprocess and returns a tuple (stdout_data, stderr_data)

(output, error) = A.communicate(input="send to a")
stefan
  • 188
  • 1
  • 7