[issue23637] Warnings error with non-ascii chars.

2015-05-17 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23637 ___

[issue23637] Warnings error with non-ascii chars.

2015-05-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 22e44a7ee89f by Serhiy Storchaka in branch '2.7': Issue #23637: Showing a warning no longer fails with UnicodeErrror. https://hg.python.org/cpython/rev/22e44a7ee89f -- nosy: +python-dev ___ Python

[issue23637] Warnings error with non-ascii chars.

2015-05-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: One of the worst things in Python 2 is that all can work on author's machine in ASCII-only environment, but then unhelpfully fail on user machine with non-ASCII data. Especially when needed a combination of few conditions for the fail. This issue is about

[issue23637] Warnings error with non-ascii chars.

2015-03-26 Thread STINNER Victor
STINNER Victor added the comment: Only thing required to make this work is add u in front of the message so it is unicode. The warnings module works with non-ASCII characters if you only use bytes strings. I'm not sure that we should enhance it to support the unicode type in some fields,

[issue23637] Warnings error with non-ascii chars.

2015-03-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem is that the warnings module works with unicode message almost all time except rare circumstances. So for sure this feature is used in many programs and it works for authors and most of users. An exception can be considered as a bug. --

[issue23637] Warnings error with non-ascii chars.

2015-03-24 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23637 ___ ___

[issue23637] Warnings error with non-ascii chars.

2015-03-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem is not only with the file.write(). If one of arguments is unicode (even if it doesn't contain non-ascii characters) and other argument is non-ascii string, we get this error. warnings.showwarning(u'', DeprecationWarning, 'filè.py', 10)

[issue23637] Warnings error with non-ascii chars.

2015-03-13 Thread Ezio Melotti
Ezio Melotti added the comment: I think that the problem is actually with the file.write() in _show_warning(). If any of the arguments of formatwarning() are unicode, the result will be unicode, and if file (default sys.stderr) is opened in binary mode, Python will try to encode the unicode

[issue23637] Warnings error with non-ascii chars.

2015-03-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch that tries to coerce non-ascii filename and line to unicode using appropriate encoding if it is needed and possible. If it is not possible, the warning just gets lost, as in the case of IO error. -- keywords: +patch stage: - patch

[issue23637] Warnings error with non-ascii chars.

2015-03-12 Thread R. David Murray
R. David Murray added the comment: Can you provide a complete failure example? If message is unicode, the format string should (in python2) be auto-promoted to unicode. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org

[issue23637] Warnings error with non-ascii chars.

2015-03-11 Thread Lukáš Němec
New submission from Lukáš Němec: File /usr/lib/python2.7/warnings.py, line 29, in _show_warning file.write(formatwarning(message, category, filename, lineno, line)) File /usr/lib/python2.7/warnings.py, line 38, in formatwarning s = %s:%s: %s: %s\n % (filename, lineno,