Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python3': 0.07; 'utf-8': 0.07; 'encode': 0.09; 'exception.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'codec': 0.16; 'lang': 0.16; 'ordinal': 0.16; 'os;': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'relevant.': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'variable': 0.18; 'skip:p 40': 0.19; 'help.': 0.21; 'feb': 0.22; 'header:User-Agent:1': 0.23; 'skip': 0.24; 'skip:l 30': 0.24; 'text.': 0.24; 'environment': 0.24; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'am,': 0.29; 'character': 0.29; "i'm": 0.30; '"",': 0.31; 'file': 0.32; 'linux': 0.33; '(most': 0.33; 'problem': 0.35; "can't": 0.35; 'but': 0.35; 'really': 0.36; "didn't": 0.36; 'turn': 0.37; 'to:addr:python-list': 0.38; 'recent': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; '2015': 0.84; 'otten': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: pydoc3.5 borks on my Mac Date: Sun, 01 Feb 2015 20:35:39 +0100 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Gmane-NNTP-Posting-Host: p57bd9e61.dip0.t-ipconnect.de User-Agent: KNode/4.13.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422819355 news.xs4all.nl 2895 [2001:888:2000:d::a6]:36847 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85022 Skip Montanaro wrote: > On Sun, Feb 1, 2015 at 11:20 AM, Peter Otten <__peter__@web.de> wrote: >> Try setting the environment variable >> >> PYTHONIOENCODING=UTF-8 > > Thanks, but that didn't help. I still get the same exception. The pager is invoked by os.popen(), and after some digging I find that it uses a io.TestIOWrapper() to write the help text. This in turn uses locale.getpreferredencoding(False), i. e. you were right to set LANG and PYTHONIOENCODING is not relevant. I'm able to provoke what I think causes your problem on linux with Python 3.4: $ LANG=en_US.utf-8 python3 -c 'import os; os.popen("cat", "w").write("\xe4\n")' รค $ LANG=en_US.ascii python3 -c 'import os; os.popen("cat", "w").write("\xe4\n")' Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 0: ordinal not in range(128) Perhaps LANG=en_US.utf-8 is not understood by your system (uppercase UTF-8? I really don't know the Mac). What does $ LANG=en_US.UTF-8 python3 -c 'import locale; print(locale.getpreferredencoding(False))' UTF-8 print?