How can I open a program (.exe) and capture an output file when i save in it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

29th Sep 2017, 9:13 PM
jason :)
3 Answers
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
30th Sep 2017, 2:09 AM
jason :)
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))
30th Sep 2017, 2:10 AM
jason :)
0
Luka I don't understand what you mean.
1st Oct 2017, 1:08 AM
jason :)