Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suggest the possible module in ModuleNotFoundError #134175

Open
Labels
stdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-featureA feature request or enhancement
@Locked-chess-official

Description

@Locked-chess-official

Feature or enhancement

Proposal:

When import the module, it will raise ModuleNotFoundError if the word is wrong. Like NameError, we can suggest the module name that might be right.

>>>import antTraceback (most recent call last):  File <stdin> line 1, in <module>import ant^^^ModuleNotFoundError:no module named 'ant'. Did you mean 'ast'?

To get all of the module, this function can get:

importpkgutildefget_available_modules():return [namefor_,name,_inpkgutil.iter_modules()]available_modules=get_available_modules()

Just need to compare the most likely module name and suggest.
Note: only when the ModuleNotFoundError was raised by python interpreter instead ofraise active

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp