I'm using subprocess to run a script from within python. I tried this
option 1
password = getpass.getpass()
from subprocess import Popen, PIPE, check_call
proc=Popen([command, option1, option2, etc...], stdin=PIPE, stdout=PIPE, stderr=PIPE)
proc.stdin.write(password)
proc.stdin.flush()
stdout,stderr = proc.communicate()
print stdout
print stderr
and this
option 2
password = getpass.getpass()
subprocess.call([command, option1, option2, etc..., password])
Neither of them work, that is, the password is not sent to the process. If I use option 2 and do not provide password, the subprocess asks me for it and everething works.