question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mypy failed with code 2

See original GitHub issue

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:

  1. Set environment variable MYPY_CONFIG_FILE_DIR to my project directory
  2. mypy.ini image
  3. 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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

2reactions
arrchercommented, Jun 15, 2022

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.

0reactions
bandophahitacommented, Sep 9, 2022

@jokance do you have a branch that could be merged?

Read more comments on GitHub >

github_iconTop Results From Across the Web

mypy exit code 2, shell mypy works, how to see verbose ...
mypy exit code 2 appears to be returned when something might be wrong with reading the file. mypy reports the error message to...
Read more >
Error codes - mypy 0.991 documentation
Error codes serve two purposes: It's possible to silence specific error codes on a line using # type: ignore[code] .
Read more >
mypy error occurred when argument name is different from the ...
You can call a Proto p as p(0) or p(x=0) . B doesn't satisfy the second. If you want B to be valid,...
Read more >
Three friends of the better code style – Python - Makimo
warn_redundant_casts — Mypy will log an error about casting an expression to its inferred type. ... In this case, Pylint shows us two...
Read more >
python/typing - Gitter
In fact, if you remove the overloading and recreate the error, mypy gives a ... I'm trying to super() a classmethod, and I'm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found