I’m trying to write a program that is going to print its prompts to standard error, and its output to standard out so that I can later manipulate the output.
I’m a bit new to python, but the documentation for getpass() shows I should be able to select a stream:
getpass.getpass([prompt[, stream]])
I have tried a variety of arguments to getpass, but I cant seem to get it to prompt in stderr. Any help would be appreciated, thank you.
>>> password = getpass.getpass("Password", sys.stderr)
TypeError: unix_getpass() takes at most 1 argument (2 given)
the stream argument to
getpass.getpass()was added in python 2.5, and isn’t available in prior versions.