Author wikipedian
Recipients
Date 2006-02-21.21:52:10
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Hi,

when using Python 2.4.1 on Linux, I get this:

>>> import getpass
>>> getpass.getpass(u'Contraseña: ')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/getpass.py", line 35, in
unix_getpass
    passwd = _raw_input(prompt)
  File "/usr/lib/python2.4/getpass.py", line 74, in
_raw_input
    prompt = str(prompt)
UnicodeEncodeError: 'ascii' codec can't encode
character u'\xf1' in position 8: ordinal not in range(128)

This one works, but only if the user's console is using
UTF-8 encoding:

>>> getpass.getpass(u'Contraseña: '.encode('utf-8'))
Contraseña:

I think you should be able to directly give a Unicode
string to getpass(), as you can also give a Unicode
string to print.


Daniel
History
Date User Action Args
2008-01-20 09:59:43adminlinkissue1436203 messages
2008-01-20 09:59:43admincreate