Skip to content

Failed to find exact letter case of module name when relative import on Windows OS #18445

Open
@trlaitioer

Description

@trlaitioer

Bug Report

Failed to find exact letter case of module name when relative import on Windows OS.

To Reproduce

ModuleName
├─ __init__.py
├─ file.py
├─ main.py

# main.py
from .file import *

Everything is fine when the path is correct with letter case.

mypy .\ModuleName\main.py
Success: no issues found in 1 source file

But if the path of files is wrong with letter case,

mypy .\moduleName\main.py

but there will be an [import-not-found] error.

moduleName\main.py:1: error: Cannot find implementation or library stub for module named "moduleName.file"  [import-not-found]

Your Environment

  • Mypy version used: mypy 1.14.1 (compiled: yes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions