I have a program called idrag.exe that is entirely command line based. It takes a minimum of 2 inputs with quotes around each, 'input.in' and 'output.out' both of which are executed by themselves. input.in is a file previously created and output.out is a file the program writes. How can I open this program, type " 'input.in' " hit enter, type " 'output.out' " and hit enter? I can open the program through os.system, but I haven't managed to get the sub process to work properly.
A big problem I am having is the ability to type once idrag.exe is open. I know I can make a .bat file with a list of commands, but I'm not inputting commands, I'm inputting text.
Edit:
For those interested here is the .exe direct download link. Here is a link to a sample input file
Edit 2:
Usually I run idrag.exe, type " 'input.in' " hit enter, type " 'output.out' " hit enter, and idrag computes its stuff and writes output.out to the current directory.
Edit 3 (this might be getting excessive):
Here is a website compiling a bunch of codes, you can ctrl + f to find idrags section. It includes all 3 fortran codes, the executable, and a bunch of sample in/out files. By no means do I expect anyone to actually go through everything and try it, but its here incase you're bored.
Final Update / Solution
Woohoo, we've done it everyone. Turns out there is an api to make things like this easy! It is called pexpect.
from pexpect import popen_spawn
process = popen_spawn.PopenSpawn('idrag.exe')
process.sendline("'test1.in'")
process.sendline("'test1.out'")
Note: popen_spawn does not automatically call from pexpect, so you have to specifically call for it. Also, syntax is slightly different on windows than it is on Mac due to unix stuff.
"test1.in"instead of"'test1.in'".