1

If i write this in command prompt: "senna-win32.exe < input.txt >output.txt" it works perfect but i need to do this from python code, how is this possible?

I have tried:

import subprocess
subprocess.call([pathToExe, "input.txt" , "output.txt"])

import subprocess
subprocess.call([pathToExe, '< input.txt > output.txt'])

I'm getting error of "invalid argument < input.txt > output.txt".

scorpion5211
  • 1,020
  • 2
  • 13
  • 33

1 Answers1

2

Thank you Jack!!!

import subprocess
myinput = open('in.txt')
myoutput = open('out.txt', 'w')
p = subprocess.Popen('senna-win32.exe', stdin=myinput, stdout=myoutput)
p.wait()
myoutput.flush()
scorpion5211
  • 1,020
  • 2
  • 13
  • 33