tubo python apenas stdin, fora uma vez, como fazer duas ou mais vezes
sucesso python pipe stdin, fora apenas uma vez esta fonte
main.py
import subprocess from subprocess import PIPE, STDOUT
player_pipe = subprocess.Popen(["source\call.py", 'arg1'], stdin=PIPE,
stdout=PIPE, stderr=STDOUT, shell=True)
player_pipe.stdin.write("Send Msg\n")
get_stdout = player_pipe.stdout.readline()
print("[Get Msg]" + get_stdout)
player_pipe.kill()
player_pipe.wait()
call.py
import sys
getMsg = raw_input()
print getMsg
mas eu quero duas ou mais vezes stdin, fora
então atualize a fonte, mas não está funcionando
O que há de errado nesta fonte
main.py (atualização - não funciona)
import subprocess from subprocess import PIPE, STDOUT
player_pipe = subprocess.Popen(["source\call.py", 'arg1'], stdin=PIPE,
stdout=PIPE, stderr=STDOUT, shell=True)
player_pipe.stdin.write("Send Msg\n")
get_stdout = player_pipe.stdout.readline()
print("[Get Msg]" + get_stdout)
player_pipe.stdin.write("Send Msg2\n")
get_stdout = player_pipe.stdout.readline()
print("[Get Msg]" + get_stdout)
player_pipe.kill()
player_pipe.wait()
call.py (atualização - não funciona)
import sys
getMsg = raw_input()
print getMsg
getMsg2 = raw_input()
print getMsg2
: D