I start a subprocess from my interactive python shell:
p = subprocess.Popen(["my_executable.exe", "my_input.txt", "my_output.pdf"], stdin=subprocess.PIPE, text=True)
my_executable.exe is a program which generates a PDF file. But the program asks for a confirmation which pops up after the command from above:
Hitting the enter key on the keyboard works fine (hence what I try below should work?) but since I need to apply my_executable.exe to thousands of files, I need to send that OK-click to the subprocess via python. I tried the following:
But as you can see, I do not even get back to my command prompt (>>>
). That horizontal bar keeps blinking and the OK button is still there / has not been clicked. I have also tried input="\n"
. This is Windows 7 / cmd.exe / python 3.7 interactive shell.