You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code should check whether base_prefix exists, and if not return a copy of prefix instead.
To Reproduce
Use the options --py2 and --python-executable.
Mypy will try to execute pyinfo.py using the given interpreter, which will fail.
Actual Behavior
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/conda/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/conda/lib/python3.9/site-packages/mypy/__main__.py", line 34, in <module>
console_entry()
File "/opt/conda/lib/python3.9/site-packages/mypy/__main__.py", line 12, in console_entry
main(None, sys.stdout, sys.stderr)
File "mypy/main.py", line 96, in main
svf.nsvf.init_handler,
File "mypy/main.py", line 173, in run_build
File "mypy/build.py", line 180, in build
File "mypy/build.py", line 212, in _build
File "mypy/modulefinder.py", line 782, in compute_search_paths
File "mypy/modulefinder.py", line 624, in get_prefixes
import getopt
File "/opt/conda/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/opt/conda/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['.../python2', '/opt/conda/lib/python3.9/site-packages/mypy/pyinfo.py', 'getprefixes']' returned non-zero exit status 1.
Running the command manually gives
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/mypy/pyinfo.py", line 43, in <module>
print(repr(getprefixes()))
File "/opt/conda/lib/python3.9/site-packages/mypy/pyinfo.py", line 22, in getprefixes
return sys.base_prefix, sys.prefix
AttributeError: 'module' object has no attribute 'base_prefix'
That's not very informative because mypy does not run on Python 2 (and I believe it never has). It still supports type checking Python 2, but to do that you need to download it using 3.6+ first.
Activity
hauntsaninja commentedon Feb 17, 2022
Thanks for the report, want to make a PR?
sobolevn commentedon Feb 23, 2022
This stas says that less that 0.04% of downloads are for python2: https://pypistats.org/packages/mypy
However, I am not sure how accurate this number is.
JelleZijlstra commentedon Feb 23, 2022
That's not very informative because mypy does not run on Python 2 (and I believe it never has). It still supports type checking Python 2, but to do that you need to download it using 3.6+ first.