If I run a terminal command from Python using subprocess
, how do I print the password prompt?
I have a Python script that asks users to authenticate via Kerberos. My program is basically this:
import subprocess
def kinit():
kinit = "kinit -f"
prompt = subprocess.check_output(kinit, shell=True)
print prompt ## echoes "Password for username@domain.com" AFTER pw input
if __name__=="__main__":
kinit()
doOtherStuff()
When this script is launched from the Terminal, the program waits for password input (which can be input via the command line), but it only displays the "Password for username@domain.com" prompt AFTER the user inputs their password.
Do you know how I can display the "Password for username@domain.com" before the Python script waits for them to input their password?