Message235200
I'm probably doing something wrong, but I've tried everything I can think of
without any success.
In Python 2.7, the pydoc command successfully displays help for the sqlite3
package, though it muffs the output of Gerhard Häring's name, spitting out
the original Latin-1 spelling. In Python 3.x, I get a UnicodeEncodeError for
my trouble, and it hoses my tty settings to boot, requiring a LF reset LF
sequence to put right unless I set PAGER to "cat".
Here's a sample run:
% PAGER=cat pydoc3.5 sqlite3
Traceback (most recent call last):
File "/Users/skip/local/bin/pydoc3.5", line 5, in <module>
pydoc.cli()
File "/Users/skip/local/lib/python3.5/pydoc.py", line 2591, in cli
help.help(arg)
File "/Users/skip/local/lib/python3.5/pydoc.py", line 1874, in help
elif request: doc(request, 'Help on %s:', output=self._output)
File "/Users/skip/local/lib/python3.5/pydoc.py", line 1612, in doc
pager(render_doc(thing, title, forceload))
File "/Users/skip/local/lib/python3.5/pydoc.py", line 1412, in pager
pager(text)
File "/Users/skip/local/lib/python3.5/pydoc.py", line 1428, in <lambda>
return lambda text: pipepager(text, os.environ['PAGER'])
File "/Users/skip/local/lib/python3.5/pydoc.py", line 1455, in pipepager
pipe.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 600: ordinal not in range(128)
I understand the error, but I see no way to convince it to use any codec
other than "ascii". Stuff I tried:
* setting PYTHONIOENCODING to "UTF-8" (suggested by Peter Otten on c.l.py)
* setting LANG to "en_US.utf8"
This is on a Mac running Yosemite with pydoc invoked in Apple's Terminal
app. Display is fine in my browser when I run pydoc as a web server.
The source it is attempting to display has a coding cookie, so it should
know that the code is encoded using Latin-1. The problem seems to all be
about generating output. |
|
Date |
User |
Action |
Args |
2015-02-01 19:24:18 | skip.montanaro | set | recipients:
+ skip.montanaro |
2015-02-01 19:24:18 | skip.montanaro | set | messageid: <1422818658.77.0.913299562674.issue23374@psf.upfronthosting.co.za> |
2015-02-01 19:24:18 | skip.montanaro | link | issue23374 messages |
2015-02-01 19:24:18 | skip.montanaro | create | |
|