[New-bugs-announce] [issue8994] pydoc does not support non-ascii docstrings

Torsten Landschoff report at bugs.python.org
Mon Jun 14 11:13:56 CEST 2010

New submission from Torsten Landschoff <t.landschoff at gmx.net>:

With the attached file doc.py I see the following behaviour:

torsten at ddhp3:~$ pydoc doc
Traceback (most recent call last):
  File "/usr/bin/pydoc", line 5, in <module>
  File "/usr/lib/python2.6/pydoc.py", line 2309, in cli
  File "/usr/lib/python2.6/pydoc.py", line 1773, in help
    elif request: doc(request, 'Help on %s:')
  File "/usr/lib/python2.6/pydoc.py", line 1516, in doc
    pager(render_doc(thing, title, forceload))
  File "/usr/lib/python2.6/pydoc.py", line 1323, in pager
  File "/usr/lib/python2.6/pydoc.py", line 1343, in <lambda>
    return lambda text: pipepager(text, 'less')
  File "/usr/lib/python2.6/pydoc.py", line 1364, in pipepager
UnicodeEncodeError: 'ascii' codec can't encode characters in position 184-186: ordinal not in range(128)

With the terminal on sys.stdout I get "UTF-8" as the encoding (sys.stdout.encoding), therefore I would expect this to work. It would be helpful to have an option to set the encoding when running pydoc as well.

And, of course, accessing the documentation via a web browser (pydoc -p 8000, firefox http://localhost:8000) I get a blank screen for the doc.py example. And a backtrace on the terminal where I started pydoc.

components: Unicode
files: doc.py
messages: 107774
nosy: torsten
priority: normal
severity: normal
status: open
title: pydoc does not support non-ascii docstrings
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file17666/doc.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list