[issue18116] getpass.getpass() triggers ResourceWarning

Serhiy Storchaka report at bugs.python.org
Thu Jun 6 10:50:59 CEST 2013


Serhiy Storchaka added the comment:

>>> getpass.getpass('Password: ', sys.stdout)
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 146, in _raw_input
    stream.write(bytes(prompt, tty_encoding))
TypeError: must be str, not bytes

>>> getpass.getpass('Password: ', io.StringIO())
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 146, in _raw_input
    stream.write(bytes(prompt, tty_encoding))
TypeError: string argument expected, got 'bytes'

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18116>
_______________________________________


More information about the Python-bugs-list mailing list