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


Groups > comp.lang.python > #74983

Re: Unicode, stdout, and stderr

From Lele Gaifax <lele@metapensiero.it>
Subject Re: Unicode, stdout, and stderr
Date 2014-07-22 09:38 +0200
Organization Nautilus Entertainments
References <lqkvn0$ptp$1@ger.gmane.org> <lql3am$2q7$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.12171.1406014806.18130.python-list@python.org> (permalink)

Show all headers | View raw


Peter Otten <__peter__@web.de> writes:

> No, both print to stdout, but just
>
>>>> x
>
> is passed to the display hook of the interactive interpreter. This applies 
> repr() and  then tries to print the result. If this fails it makes another 
> effort, roughly (the actual code is written in C)
>
> sys.stdout.buffer.write(repr(x).encode(
>     sys.stdout.encoding, "backslashreplace"))

Ah-moment!

Thanks,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Unicode, stdout, and stderr Lele Gaifax <lele@metapensiero.it> - 2014-07-22 09:38 +0200

csiph-web