This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients alex, benjamin.peterson, hynek, nikratio, pitrou, serhiy.storchaka, stutzbach, vajrasky
Date 2013-06-06.14:32:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1370529159.64.0.556954939527.issue18116@psf.upfronthosting.co.za>
In-reply-to
Content
>>> getpass.getpass('Password: ', open('/dev/stdout', 'w'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/getpass.py", line 72, in unix_getpass
    passwd = _raw_input(prompt, stream, input=input)
  File "/home/serhiy/py/cpython/Lib/getpass.py", line 143, in _raw_input
    stream.write(bytes(prompt, tty_encoding))
TypeError: must be str, not bytes

It seems that you are moving in the wrong direction. No need to test explicitly for stdout/stderr/etc, the code should work with arbitrary text stream.
History
Date User Action Args
2013-06-06 14:32:39serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, benjamin.peterson, stutzbach, alex, nikratio, hynek, vajrasky
2013-06-06 14:32:39serhiy.storchakasetmessageid: <1370529159.64.0.556954939527.issue18116@psf.upfronthosting.co.za>
2013-06-06 14:32:39serhiy.storchakalinkissue18116 messages
2013-06-06 14:32:39serhiy.storchakacreate