On posix, it would be useful if I could have getpass.getpass() write the prompt to stderr or to an arbitrary stream (file-like object), rather than always writing to stdin. In my use case, I need to send the results of a command-line script to stdout after the user authenticates, and the user may be redirecting stdout, so I don't want the password prompt to pollute the output. If I could have the "Password: " show up in stderr, that would be ideal. I don't think this would be terribly difficult to implement an API like def getpass(prompt='', stream=None) if stream is None: stream = sys.stdin ... but I'm unsure of the nuances of termios and arbitrary streams. Would it be better to just make the choice be between stdin and stderr? -- in which case the API would be something like def getpass(prompt='', use_stderr=False) Or is the whole exercise a waste of time? Thanks
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4