Skip to content

Module '<namespace package>' has no attribute '<module/pkg in namespace>' #9619

Closed as not planned
@jaraco

Description

@jaraco

Bug Report

Attempting to run mypy on jaraco.ui, I'm getting an error:

_________________________________________________ jaraco/ui/cmdline.py _________________________________________________
5: error: Module 'jaraco' has no attribute 'text'

Here is the pertinent code, namely:

from jaraco import text

The module text is supplied by a separate package jaraco.text. The jaraco namespace uses the pkgutil style namespaces (mostly for historical reasons as the code is Python 3-only now, but could still interact with older builds).

This issue is related to #9393, although that issue indicates a different failure mode. Also possibly relevant #6385, #7029.

To Reproduce

git clone https://github.com/jaraco/jaraco.ui
cd jaraco.ui
git checkout eacca37
tox -- -k cmdline

Expected Behavior

mypy should recognize working implementations of extant modules and not fail.

Actual Behavior

Error reported above is emitted.

Your Environment

  • Mypy version used: 0.790
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files):
    ignore_missing_imports = True
  • Python version used: 3.9.0
  • Operating system and version: macOS 10.15

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