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


Groups > comp.lang.python > #74983

Re: Unicode, stdout, and stderr

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'interpreter.': 0.07; 'tries': 0.07; 'received:151': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'emanuele': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'repr()': 0.16; 'subject:Unicode': 0.16; 'applies': 0.16; 'thanks,': 0.17; 'result.': 0.19; 'written': 0.21; '(the': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'skip:" 20': 0.27; 'header:X -Complaints-To:1': 0.27; 'code': 0.31; '>>>>': 0.31; 'writes:': 0.31; 'another': 0.32; 'actual': 0.34; 'display': 0.35; 'skip:s 30': 0.35; 'no,': 0.35; 'but': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'che': 0.60; 'otten': 0.84; 'quando': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Lele Gaifax <lele@metapensiero.it>
Subject Re: Unicode, stdout, and stderr
Date Tue, 22 Jul 2014 09:38:51 +0200
Organization Nautilus Entertainments
References <lqkvn0$ptp$1@ger.gmane.org> <lql3am$2q7$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 151.62.51.3
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux)
Cancel-Lock sha1:K7SpG3aO9OpzC3A7wUX8K3P8lGs=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12171.1406014806.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406014806 news.xs4all.nl 2867 [2001:888:2000:d::a6]:39260
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:74983

Show key headers only | 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