output.txt" it works fine, but...">

Python launches .exe application with argument

If I write this on the command line: "senna-win32.exe <input.txt> output.txt" it works fine, but I need to do it from python code, how is this possible?

I tried:

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

      


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

      

I am getting the error "Invalid <input.txt> output.txt" argument.

+1


source to share


1 answer


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()

      

+2


source







All Articles