This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dlax
Recipients dlax
Date 2022-01-12.08:53:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641977598.42.0.091371841843.issue46353@roundup.psfhosted.org>
In-reply-to
Content
On my (Debian 10) system, 'pydoc -k' crashes as follows:                              

    $ python3 -m pydoc -k foo
    Traceback (most recent call last):
      File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/usr/lib/python3.9/pydoc.py", line 2862, in <module>
        cli()
      File "/usr/lib/python3.9/pydoc.py", line 2795, in cli
        apropos(val)
      File "/usr/lib/python3.9/pydoc.py", line 2287, in apropos
        ModuleScanner().run(callback, key, onerror=onerror)
      File "/usr/lib/python3.9/pydoc.py", line 2248, in run
        loader = spec.loader
    AttributeError: 'NoneType' object has no attribute 'loader'

(The same happens with current 'main' of CPython.)

The module that is tried to be loaded is 'ansible.galaxy.data', installed in /usr/lib/python3/dist-packages/ and it uses a custom (Ansible) finder _AnsiblePathHookFinder.

Maybe this finder has problems, but since Finder.find_module() may return None, I believe this should be handled by pydoc's ModuleScanner.

If agreed, I'll prepare a fix accordingly.
History
Date User Action Args
2022-01-12 08:53:18dlaxsetrecipients: + dlax
2022-01-12 08:53:18dlaxsetmessageid: <1641977598.42.0.091371841843.issue46353@roundup.psfhosted.org>
2022-01-12 08:53:18dlaxlinkissue46353 messages
2022-01-12 08:53:18dlaxcreate