Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #59860 > unrolled thread

Re: [Python-ideas] Unicode stdin/stdout

Started byNick Coghlan <ncoghlan@gmail.com>
First post2013-11-18 22:59 +1000
Last post2013-11-18 22:59 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [Python-ideas] Unicode stdin/stdout Nick Coghlan <ncoghlan@gmail.com> - 2013-11-18 22:59 +1000

#59860 — Re: [Python-ideas] Unicode stdin/stdout

FromNick Coghlan <ncoghlan@gmail.com>
Date2013-11-18 22:59 +1000
SubjectRe: [Python-ideas] Unicode stdin/stdout
Message-ID<mailman.2841.1384779566.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On 18 Nov 2013 22:36, "Robin Becker" <robin@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-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web