Red Hat Bugzilla – Bug 1292126
Traceback when trying to view documentation
Last modified: 2015-12-16 19:00:25 EST
Description of problem:
Traceback when trying to view documentation using pydoc.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. pydoc pyudev
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site.py", line 459, in __call__
return pydoc.help(*args, **kwds)
File "/usr/lib64/python2.7/pydoc.py", line 1745, in __call__
File "/usr/lib64/python2.7/pydoc.py", line 1792, in help
else: doc(request, 'Help on %s:')
File "/usr/lib64/python2.7/pydoc.py", line 1529, in doc
pager(render_doc(thing, title, forceload))
File "/usr/lib64/python2.7/pydoc.py", line 1334, in pager
File "/usr/lib64/python2.7/pydoc.py", line 1354, in <lambda>
return lambda text: pipepager(text, 'less')
File "/usr/lib64/python2.7/pydoc.py", line 1375, in pipepager
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 9159: ordinal not in range(128)
This is essentially a pydoc error, see: https://bugs.python.org/issue1065986.
It was fixed in some version of python between 2.7.5, where the problem still appears, and 2.7.10, where it does not seem to be present. It is also fixed in python v 3.0.
Note: You might be wondering why pyudev is triggering this bug, when many other packages do not. The reason is that the developer of pyudev chose to import unicode_literals from __future__ in every file. This means that all literal strings are automatically unicode, including docstrings.
And, btw, I have found the offending ASCII '-'s, and changed them to ','s (https://github.com/mulkieran/pyudev/commit/46ae2eb0d966aea40ddd0e66f3fdf71e3b12b34a). This means that pyudev should no longer trigger this bug in the next version (0.19).