Mypy failed with code 2
Step 1: Are you in the right place?
- [ ] I have verified there are no duplicate active or recent bugs, questions, or requests
- [ ] I have verified that I am using the latest version of the plugin.
Step 2: Describe your environment
- Plugin version:
0.14.0 - PyCharm/IDEA version:
2022.1.2 (Community Edition) - Mypy version:
0.961
Step 3: Describe the problem:
Steps to reproduce:
- Set environment variable MYPY_CONFIG_FILE_DIR to my project directory
- mypy.ini

- click "check current file" button
The scan failed due to an exception: Mypy failed with code 2 com.leinardi.pycharm.mypy.exception.MypyToolException: Mypy failed with code 2 at com.leinardi.pycharm.mypy.mpapi.MypyRunner.runMypy(MypyRunner.java:324) at com.leinardi.pycharm.mypy.mpapi.MypyRunner.scan(MypyRunner.java:266) at com.leinardi.pycharm.mypy.checker.ScanFiles.scan(ScanFiles.java:109) at com.leinardi.pycharm.mypy.checker.ScanFiles.checkFiles(ScanFiles.java:100) at com.leinardi.pycharm.mypy.checker.ScanFiles.call(ScanFiles.java:74) at com.leinardi.pycharm.mypy.checker.ScanFiles.call(ScanFiles.java:46) at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:326) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:829)
if I set mypy_path = $MYPY_CONFIG_FILE_DIR/src , it can run correctly, seem the Plugin not support multi paths
Hi
The plugin itself does not read the mypy configuration file. The plugin invokes the mypy command, and mypy exits with error code 2 in your situation.
Please try running mypy from command line directly and see what error message it produces.
Thanks for reply!
So I run mypy with command line: C:\PathToMyPy\mypy.exe --config-file F:\MyProject\mypy.ini F:\MyProject\src\main.py, it work correctly.
But if I run in mypy-pycharm plugin, it exits with error code 2, here is the settings:

Got the same issue with the same exception stack
The scan failed due to an exception: Mypy failed with code 2 com.leinardi.pycharm.mypy.exception.MypyToolException: Mypy failed with code 2 at com.leinardi.pycharm.mypy.mpapi.MypyRunner.runMypy(MypyRunner.java:324) at com.leinardi.pycharm.mypy.mpapi.MypyRunner.scan(MypyRunner.java:266) at com.leinardi.pycharm.mypy.checker.ScanFiles.scan(ScanFiles.java:109) at com.leinardi.pycharm.mypy.checker.ScanFiles.checkFiles(ScanFiles.java:100) at com.leinardi.pycharm.mypy.checker.ScanFiles.call(ScanFiles.java:74) at com.leinardi.pycharm.mypy.checker.ScanFiles.call(ScanFiles.java:46) at com.intellij.openapi.application.impl.ApplicationImpl$2.call(ApplicationImpl.java:326) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:829)
The system is MacOS Catalina if it matters.
Well, I check the source code, and found that we don't need these code below:

I built another version and put here, enjoy! mypy-plugin-0.14.1.zip
@jokance do you have a branch that could be merged?