-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't working
Description
Describe the bug
I am trying to import a module without __init__.py and read its __path__. Accessing it works at runtime, but pyright reports that there is no such attribute.
Code or Screenshots
Directory tree:
drwx------@ - rijenkii 10 Jul 11:28 .
drwxr-xr-x@ - rijenkii 10 Jul 11:28 └── src
drwxr-xr-x@ - rijenkii 10 Jul 11:32 └── app
.rw-r--r--@ 52 rijenkii 10 Jul 11:29 ├── main.py
drwxr-xr-x@ - rijenkii 10 Jul 11:28 └── namespace
main.py:
import app.namespace
print(app.namespace.__path__)main.py output:
$ PYTHONPATH=src uv run python -m app.main
_NamespacePath(['/tmp/tmp.oDLOLEveoQ/src/app/namespace'])
pyright output:
$ uv run --with pyright==1.1.403 pyright .
/tmp/tmp.oDLOLEveoQ/src/app/main.py
/tmp/tmp.oDLOLEveoQ/src/app/main.py:3:21 - error: "__path__" is not a known attribute of module "app.namespace" (reportAttributeAccessIssue)
1 error, 0 warnings, 0 informations
Repro setup commands
cd $(mktemp -d)
mkdir -p src/app/namespace
echo -e 'import app.namespace\n\nprint(app.namespace.__path__)' >src/app/main.pyVS Code extension or command-line
CLI, version 1.1.403.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
addressed in next versionIssue is fixed and will appear in next published versionIssue is fixed and will appear in next published versionbugSomething isn't workingSomething isn't working