0
How can I open a program (.exe) and capture an output file when i save in it?
I'm trying to open a program from within python, and when I save a file from that program, I'd like my code to run automatically against the created file. I know I can open a program, but I'm not sure how to detect the output file. I've found documentation for subprocess' but it's a lot to take in. Any help would greatly be appreciated. thanks
4 Respostas
0
I tried this. opened great. could not get file path.
from subprocess import check_output as qx
cmd = r'C:\Program Files (x86)\CraftWare\CraftWare.exe'
output = qx(cmd)
print
0
next, tried this...
from subprocess import Popen,PIPE
cmd = r'C:\Program Files (x86)\Craftware\CraftWare.exe'
p = Popen(cmd, stdin=PIPE, stdout=None, stderr=None, universal_newlines=True)
stdout_text, stderr_text = p.communicate(input="1\n\n")
print("stdout: %r\nstderr: %r" % (stdout_text, stderr_text))
if p.returncode !=0:
raise RuntimeError("%r failed, status code %d" % (cmd, p.returncode))
0
Luka I don't understand what you mean.