Skip to content

help CLI shows a traceback when import failed #102541

Description

@Eclips4

Currently, help will show a traceback when we type name of something which doesn't exist:

help>123Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"<frozen _sitebuiltins>", line103, in__call__File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line2004, in__call__self.interact()
File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line2031, ininteractself.help(request)
File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line2057, inhelpelifrequest: doc(request, 'Help on %s:', output=self._output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line1781, indocpager(render_doc(thing, title, forceload))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line1755, inrender_docobject, name=resolve(thing, forceload)
^^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\KIRILL-1\CLionProjects\cpython\Lib\pydoc.py", line1741, inresolveraiseImportError('''\ImportError: No Python documentation found for '123'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
>>>

I think, this shouldn't be shown.
Is there any reason for this?
Can we show something like
No python documentation found for '123'.?

Reproducible on current main.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixesrelease-blockertype-bugAn unexpected behavior, bug, or error

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions