Bug 1292126

Summary: Traceback when trying to view documentation
Product: Red Hat Enterprise Linux 7 Reporter: Branislav Náter <bnater>
Component: python-pyudevAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: amulhern
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-16 15:22:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Branislav Náter 2015-12-16 14:35:28 UTC
Description of problem:
Traceback when trying to view documentation using pydoc.

Version-Release number of selected component (if applicable):
python-pyudev-0.15-7.el7

How reproducible:
always

Steps to Reproduce:
1. pydoc pyudev

Actual results:
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__
    self.help(request)
  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
    pager(text)
  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
    pipe.write(text)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 9159: ordinal not in range(128)

Expected results:
Documentation displayed

Comment 2 mulhern 2015-12-16 15:22:28 UTC
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.

Comment 3 mulhern 2015-12-16 15:58:24 UTC
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).