Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85022
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: pydoc3.5 borks on my Mac |
| Date | 2015-02-01 20:35 +0100 |
| Organization | None |
| References | <CANc-5Uy8dHuosWgnXo7PdrR-Or7tY4EEHWaHte2nTNjtOk9H2g@mail.gmail.com> <CANc-5Uz7QXgF=pTAz++9cuDSm_JYiRAdsy55VZnioY_R5rGgZw@mail.gmail.com> <maln83$iga$1@ger.gmane.org> <CANc-5UwioovOz6Ydf5VPAxwRPfBWRLX7p5UBQecm9zFbwma5ng@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18372.1422819355.18130.python-list@python.org> (permalink) |
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 "<string>", line 1, in <module>
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?
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: pydoc3.5 borks on my Mac Peter Otten <__peter__@web.de> - 2015-02-01 20:35 +0100
csiph-web