Drekin added the comment:

File redirection has nothing to do with win-unicode-console and this issue. 
When stdout is redirected, it is not a tty so win-unicode-console doesn't 
replace the stream object, which is the right thing to do. You got 
UnicodeEncodeError because Python creates sys.stdout with encoding based on 
your locale. In my case it is cp1250 which cannot encode whole Unicode. You can 
control the encoding used by setting PYTHONIOENCODING environment variable. For 
example, if you have a script producer.py, which prints some Unicode 
characters, and consumer.py, which just does print(input()), then "py 
producer.py | py consumer.py" shows that redirection works (when 
PYTHONIOENCODING is set e.g. to utf-8).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1602>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to