python packages versus pydoc -k

Josh Stone jistone at redhat.com
Thu Mar 13 18:23:32 UTC 2014


On 03/13/2014 10:39 AM, Florian Festi wrote:
> On 03/12/2014 08:18 PM, Josh Stone wrote:
>> For instance, right now I get:
>>
>>> $ pydoc -k xyzzy
>>> lib2to3.fixes.fix_repr - Fixer that transforms `xyzzy` into repr(xyzzy).
>>> Traceback (most recent call last):
>>>   File "/usr/bin/pydoc", line 5, in <module>
>>>     pydoc.cli()
>>>   File "/usr/lib64/python2.7/pydoc.py", line 2292, in cli
>>>     apropos(val)
>>>   File "/usr/lib64/python2.7/pydoc.py", line 1992, in apropos
>>>     ModuleScanner().run(callback, key, onerror=onerror)
>>>   File "/usr/lib64/python2.7/pydoc.py", line 1973, in run
>>>     module = loader.load_module(modname)
>>> AttributeError: 'NoneType' object has no attribute 'load_module'
>>
>> It's hard to track that down, but with "strace -e open" it looks like
>> somewhere in site-packages/rpm/.  I couldn't figure out exactly which
>> subpackage is triggering this.
> 
> I really would like to get this fixed if it really is a problem in
> rpm-python. But someone needs to come up with some better error messages
> or other way of finding out what the actual problem is. After a quick
> view in the pydoc doc I am no longer sure that this is an rpm problem,
> though. This could also be a bug in pydoc or pkgutil or some other
> python module being processed.

Sorry, I should have tried pdb first, because this one has nothing to do
with rpm-python.  I can see modname='PyQt4.uic.pyuic', and prior to the
exception site is a line 'loader = importer.find_module(modname)', which
is where the None came from.  I can confirm this one in a clean mock
root with just PyQt4 added (and its dependencies).

This one might be a bug in the way pydoc -k iterates, because I can't
even target that name directly:

$ pydoc PyQt4.uic.pyuic
no Python documentation found for 'PyQt4.uic.pyuic'

$ python -c 'import PyQt4.uic.pyuic'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named pyuic


FWIW, a clean mock root with python3-PyQt4 is fine with pydoc3 -k.


More information about the devel mailing list