I am trying to automate a Windows app that requires input via a GUI using Python 2.7 script. I am calling the exe via the built-in python subprocess functions as follows:
import subprocess
cc= 'C:\MM\test.exe'
subprocess.call(cc)
When the exe is called, a GUI requires that I enter a path manually for the input file, a data.txt file. When I enter the path processing can begin. I would somehow like to automate this process, namely, just call the exe and have it find the input.txt by itself and also importantly, print the output to an output.txt file.
I initially tried the following suggestions:
import subprocess
with open(r'C:\MMA\DATA\input.txt', 'r') as input_file, open(r'C:\MMA\DATA\output.txt', 'w') as output_file: subprocess.call(['C:\MM\test.exe'], stdin=input_file, stdout=output_file)
However, this was unsuccessful; the exe still required that I enter the input file path manually.
I am not sure how to proceed here, I have no experience with this sort of issue, and any help would be very much appreciated. Thank you in advance, paulc.