Closed reinderien closed 2 years ago
Thanks for the report!
@AlexWaygood if you're up for it, want to make another "improve mypy on Windows" PR? :-)
(For context, mypy does a sneaky amount of "actual runtime" work by executing mypy/pyinfo.py
. In this case, we're figuring out site packages in mypy/modulefinder.py
)
@AlexWaygood if you're up for it, want to make another "improve mypy on Windows" PR? :-)
Might be difficult for me to find the time, I'm afraid — I've already got quite a lot on ://
Egg meet face: this is entirely my fault, and was due to an explicit - and incorrect - python_executable
setting in a surprise .ini
that was being applied.
Bug Report
On Windows, running Python 3.8 with mypy 0.931 installed to a virtualenv, it cannot start with any of these methods:
cmd
,.venv\Scripts\activate.bat
, thenmypy
mypy --python-executable .\venv\Scripts\python.exe
python -m mypy --python-executable .\venv\Scripts\python.exe
from mypy.main import main
python -m mypy
python -m mypy --python-executable .\venv\Scripts\python.exe
In all cases, I get this stack trace:
In this context,
args
is./.venv/bin/python C:\\Users\\me\\src\\myproject\\.venv\\lib\\site-packages\\mypy\\pyinfo.py getsitepackages'
.mypy.modulefinder.get_site_packages_dirs
is passing in an incorrect path to Python, because on Windows.venv/bin/python
is the wrong path to a venv Python binary, and should instead be./.venv/Scripts/python.exe
. Doing the really bad thing and editingPython38/Lib/subprocess.py
so thatcheck_output
contains"fixes" the problem.