[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
R. David Murray added the comment: Ok, I'll reopen the issue to do that. -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: Another patch with docs update and one line code comment. -- Added file: http://bugs.python.org/file34815/issue21169_v7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Roundup Robot added the comment: New changeset bdde36cd9048 by R David Murray in branch '3.4': #21169: add comment and doc update for getpass change. http://hg.python.org/cpython/rev/bdde36cd9048 New changeset fe532dccf8f6 by R David Murray in branch 'default': Merge: #21169: add comment and doc update for getpass change. http://hg.python.org/cpython/rev/fe532dccf8f6 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
R. David Murray added the comment: I decided to tweak the language slightly, Kushal. If this isn't what you were looking for, Martin, let me know. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Serhiy Storchaka added the comment: I don't think this is a bug. Any text output operation can fail when outputs unencodable string. You should use a stream with proper encoding and/or error handler. -- nosy: +serhiy.storchaka resolution: - invalid stage: needs patch - committed/rejected status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Martin v. Löwis added the comment: I agree that it is not a bug if the device where the prompt is shown simply does not support the characters; on Unix, this includes cases where the locale does not support the characters. Arfrever: when you say that it fails in Python 3 in a non-UTF-8 locale, which specific locale was that that it failed in? -- nosy: +loewis status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Serhiy Storchaka added the comment: $ LC_ALL=en_US.iso88591 ./python -c print('\u20ac') Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 0: ordinal not in range(256) $ LC_ALL=en_US.iso88591 ./python -c input('\u20ac') Traceback (most recent call last): File string, line 1, in module UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 0: ordinal not in range(256) $ LC_ALL=en_US.iso88591 ./python -c import getpass; getpass.getpass('\u20ac') Traceback (most recent call last): File string, line 1, in module File /home/serhiy/py/cpython/Lib/getpass.py, line 78, in unix_getpass passwd = _raw_input(prompt, stream, input=input) File /home/serhiy/py/cpython/Lib/getpass.py, line 138, in _raw_input stream.write(prompt) UnicodeEncodeError: 'latin-1' codec can't encode character '\u20ac' in position 0: ordinal not in range(256) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Arfrever Frehtes Taifersar Arahesis added the comment: Martin v. Löwis: In this case, device support non-ASCII characters, but Python's getpass module forgets to properly encode string. Message 215697 contains example with C locale. -- resolution: invalid - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: Here is a new patch which uses stream.encoding instead getting the encoding from the locale as suggested by David. It also contains the new test. -- Added file: http://bugs.python.org/file34807/issue21169_v5.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: New patchset with updated test, now sending ascii stream into the call as argument. -- Added file: http://bugs.python.org/file34810/issue21169_v6.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Martin v. Löwis added the comment: Arfrever: If you set the locale to C, the device does *not* (anymore) support the character. The terminal application you are using may, but the system does not. It only supports the characters available in the locale, which your character is not. There simply is no way in which Python *could* encode the character. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Roundup Robot added the comment: New changeset f430fdd1628e by R David Murray in branch '3.4': #21169: fix getpass to use replace error handler on UnicodeEncodeError. http://hg.python.org/cpython/rev/f430fdd1628e New changeset 461f5863f2aa by R David Murray in branch 'default': Mierge #21169: fix getpass to use replace error handler on UnicodeEncodeError. http://hg.python.org/cpython/rev/461f5863f2aa -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
R. David Murray added the comment: Since we don't want the prompting for the password to fail, what we do in the patch is use the replace error handler so that you get as much as could be encoded of the prompt. (Note: this approach was reviewed by both Toshio and Marc Andre.) Thanks for the patch, Kushal. -- resolution: - fixed status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Martin v. Löwis added the comment: Ok. I wish the patch had a comment saying that, or better even a documentation change pointing out that feature. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: Updated patch with discovering of currect locale and corresponding test case. -- Added file: http://bugs.python.org/file34775/issue21169_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: New patch with actual test case :) -- Added file: http://bugs.python.org/file34776/issue21169_v4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: Here is a patch which stops the breakage in getpass for python3. -- keywords: +patch nosy: +kushaldas Added file: http://bugs.python.org/file34766/issue21169.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Kushal Das added the comment: Version 2 of the patch with a test update. -- Added file: http://bugs.python.org/file34767/issue21169_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
New submission from Arfrever Frehtes Taifersar Arahesis: getpass.getpass() fails with non-ASCII characters in prompt. The attached example scripts (for Python 2 and 3) contain non-ASCII unicode prompt (Polish hasło == English password) written in UTF-8. Python-2 version fails always. Python-3 version fails in non-UTF-8 locale. $ ./getpass_test_python2 Traceback (most recent call last): File ./getpass_test_python2, line 5, in module getpass.getpass(uHasło: ) File /usr/lib64/python2.7/getpass.py, line 71, in unix_getpass passwd = _raw_input(prompt, stream, input=input) File /usr/lib64/python2.7/getpass.py, line 128, in _raw_input prompt = str(prompt) UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 3: ordinal not in range(128) $ LC_ALL=en_US.UTF-8 ./getpass_test_python3 Hasło: $ LC_ALL=C ./getpass_test_python3 Traceback (most recent call last): File ./getpass_test_python3, line 5, in module getpass.getpass(Has\u0142o: ) File /usr/lib64/python3.4/getpass.py, line 78, in unix_getpass passwd = _raw_input(prompt, stream, input=input) File /usr/lib64/python3.4/getpass.py, line 138, in _raw_input stream.write(prompt) UnicodeEncodeError: 'ascii' codec can't encode character '\u0142' in position 3: ordinal not in range(128) $ -- components: Library (Lib) keywords: easy messages: 215697 nosy: Arfrever priority: normal severity: normal stage: needs patch status: open title: getpass.getpass() fails with non-ASCII characters in prompt versions: Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: Added file: http://bugs.python.org/file34747/getpass_test_python2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21169] getpass.getpass() fails with non-ASCII characters in prompt
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: Added file: http://bugs.python.org/file34748/getpass_test_python3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21169 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com