1

I have a program that when I run in shell, it asks for input from the user. When I run it as follows with subprocess.Popen, it does not get into the part of the program where it asks for input and it just finishes. How could I change that?

cmd = ["./pairwise", "-seq", sites, "-loc", locs, "-lk", "species_genotypenew_lk.txt", "-prefix", ldhat_out]
subprocess.Popen(cmd)

Thanks!

Homap
  • 2,142
  • 5
  • 24
  • 34

1 Answers1

1

if pairwise is reads from stdin and writes to stdout

subprocess.Popen(cmd).communicate()

should do it.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134