-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeImport systemNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementationnamespace-package
Description
Steps to reproduce
Given multiple files:
.
`-- a/
|-- a.py
`-- b.py
Which are all empty, running pylint a
fails:
$ pylint a
************* Module a
a/__init__.py:1:0: F0010: error while code parsing: Unable to load file a/__init__.py:
[Errno 2] No such file or directory: 'a/__init__.py' (parse-error)
$
However, if I rename a.py
, pylint a
succeeds:
$ mv a/a.py a/c.py
$ pylint a
$
Alternatively, I can also touch a/__init__.py
, but that shouldn't be necessary anymore.
Current behavior
Running pylint a
if a/a.py
is present fails while searching for an __init__.py
file.
Expected behavior
Running pylint a
if a/a.py
is present should succeed.
pylint --version output
Result of pylint --version
output:
pylint 3.0.0a3
astroid 2.5.6
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0]
Additional info
This also has some side-effects in module resolution. For example, if I create another file r.py
:
.
|-- a
| |-- a.py
| `-- b.py
`-- r.py
With the content:
from a import b
Running pylint -E r
will run fine, but pylint -E r a
will fail. Not just for module a, but for module r as well.
************* Module r
r.py:1:0: E0611: No name 'b' in module 'a' (no-name-in-module)
************* Module a
a/__init__.py:1:0: F0010: error while code parsing: Unable to load file a/__init__.py:
[Errno 2] No such file or directory: 'a/__init__.py' (parse-error)
Again, if I rename a.py
to c.py
, pylint -E r a
will work perfectly.
Metadata
Metadata
Assignees
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeImport systemNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementationnamespace-package
Activity
hippo91 commentedon May 14, 2021
@iFreilicht thanks for your report.
parse-error
raised if directory matches standard library name #4909jacobtylerwalls commentedon Jul 3, 2022
#4909 was a duplicate.
jacobtylerwalls commentedon Aug 13, 2022
#7114 was not correct and will be reverted in #7304.
Regression test for
test_lint.py
for anyone attempting a fix: