Skip to content

False positive import-error #3984

Open
Open
@sam-s

Description

@sam-s

Steps to reproduce

in an empty directory:

  1. file a.py:
def a():
    print("a")
  1. file b.py
import a
print(a.a())
  1. empty file __init__.py

Current behavior

pylint b.py
b.py:1: [E0401(import-error), ] Unable to import 'a'

Expected behavior

no diagnostics

Important note

if you remove __init__.py, the import-error disappears.

pylint --version output

pylint 2.6.0
astroid 2.4.2
Python 3.9.1 (default, Dec 10 2020, 10:36:35)
[Clang 12.0.0 (clang-1200.0.32.27)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeImport systemNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions