Sep-03-2018, 08:51 AM
Hello,
I'm making a little program that runs a cmd command on Windows. That command needs a password and a verification of the password from the user to be typed it in the terminal. What I want to do is to send the password myself from the program to the terminal. The program looks something like this:
I'm making a little program that runs a cmd command on Windows. That command needs a password and a verification of the password from the user to be typed it in the terminal. What I want to do is to send the password myself from the program to the terminal. The program looks something like this:
from subprocess import * p = Popen("Command that does something and asks for a password", stdin=PIPE, stdout=PIPE, shell=True)I have tried different solutions but none of them have worked. I've tried this:
p.communicate(b"secret password\n") #I have tried with and without the \nAnd also this:
p.stdin.write("secret password")I don't get any error message, but the terminal still asks me for password.