On 18 Nov 2013 22:36, "Robin Becker" <ro...@reportlab.com> wrote:
>
> On 18/11/2013 11:47, Robin Becker wrote:
> ...........
>>
>> #c:\python33\lib\site-packages\sitecustomize.py
>> import sys, codecs
>> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
>> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
>
> ........
> it seems that the above needs extra stuff to make some distutils logging
work etc etc; so now I'm using sitecustomize.py containing
>
> import sys, codecs
> sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
> sys.stdout.encoding = 'utf8'
> sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach())
> sys.stderr.encoding = 'utf8'

Note that calling detach() on the standard streams isn't officially
supported, since it breaks the shadow streams saved in sys.__stderr__, etc.

Cheers,
Nick.

>
> --
> Robin Becker
>
> _______________________________________________
> Python-ideas mailing list
> python-id...@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to