microsoft / microsoft/vscode-mypy

Can not fallback to bundled mypy with fromEnvironment

Open
#184 5 comments 11 reactions 1 assignee View on GitHub

@karthiknadig is already working on this.

Since Oct 23, 2023.

bug needs PR
Dominant language
Python
Stars
150
Forks
39
Avg merge
21h 45m
Merged PRs (30d)
8

Description

- Extension: `2023.4`
- Import strategy: `fromEnvironment`

When a python file is saved in an environment where mypy is not installed, there is this in the output:

```
2023-10-23 20:32:45.177 [info] Error while checking mypy executable:
Traceback (most recent call last):
File "/home/eric/.vscode-oss/extensions/ms-python.mypy-type-checker-2023.4.0-universal/bundled/tool/lsp_server.py", line 102, in get_mypy_info
first_line = result.stdout.splitlines(keepends=False)[0]
IndexError: list index out of range

2023-10-23 20:32:45.177 [info] [Trace - 8:32:45 PM] Received notification 'window/logMessage'.
2023-10-23 20:32:45.177 [info] [Error - 8:32:45 PM] Linting failed with error:
Traceback (most recent call last):
File "/home/eric/.vscode-oss/extensions/ms-python.mypy-type-checker-2023.4.0-universal/bundled/tool/lsp_server.py", line 187, in _linting_helper
version = get_mypy_info(settings).version
AttributeError: 'NoneType' object has no attribute 'version'
```

It works again if either `mypy` is installed in the environment or if import strategy is changed to `useBundled`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.