mypy config file is not valid
eroller opened this issue · 3 comments
eroller commented
Step 1: Are you in the right place?
- [X ] I have verified there are no duplicate active or recent bugs, questions, or requests
- [X ] I have verified that I am using the latest version of the plugin.
Step 2: Describe your environment
- Plugin version:
0.11.2
- PyCharm/IDEA version:
Professional 2020.2
- Mypy version:
0.790
Step 3: Describe the problem:
Steps to reproduce:
- Install plugin and restart PyCharm
- Test mypy executable in settings (working)
- Confirm config file setting automatically set to setup.cfg in my git working directory (i.e.
C:/Projects/DragenEngineering/trip_runner2/setup.cfg
) - Open mypy tool window and run scan
Observed Results:
- The scan failed due to an error -please see the event log for more information
Expected Results:
- successfully report any mypy issues
Event Log
9:55 AM Unexpected Exception Caught
The scan failed due to an exception: mypy config file is not valid. File does not exist or can't be read.
com.leinardi.pycharm.mypy.exception.MypyPluginException: mypy config file is not valid. File does not exist or can't be read.
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.getMypyConfigFile(MypyRunner.java:197)
at com.leinardi.pycharm.mypy.mpapi.MypyRunner.scan(MypyRunner.java:249)
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.MypyInspection.inspectFile(MypyInspection.java:88)
at com.leinardi.pycharm.mypy.MypyInspection.lambda$checkFile$0(MypyInspection.java:65)
at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:2... (show balloon)
Setup,cfg
[mypy]
disallow_untyped_calls = True
disallow_untyped_defs = True
disallow_incomplete_defs = True
check_untyped_defs = True
disallow_subclassing_any = True
warn_no_return = True
strict_optional = True
strict_equality = True
no_implicit_optional = True
disallow_any_generics = True
disallow_any_unimported = False
warn_redundant_casts = True
warn_unused_ignores = True
warn_unused_configs = True
show_traceback = True
show_error_codes = True
always_false = MYPYC
python_version = 3.7
namespace_packages = True
eroller commented
I found a workaround:
In Mypy PyCharm Settings I removed the auto-filled value in "Path to config file" and added this to the Arguments:
--config-file=C:/Projects/DragenEngineering/trip_runner2/setup.cfg
eroller commented
Some more information about the bug: the file .idea/mypy.xml was:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MypyConfigService">
<option name="mypyConfigFilePath" value="$PROJECT_DIR$/setup.cfg" />
</component>
</project>
Perhaps the $PROJECT_DIR$
is not parsed correctly?
Kobu commented
I found a workaround:
In Mypy PyCharm Settings I removed the auto-filled value in "Path to config file" and added this to the Arguments:
--config-file=C:/Projects/DragenEngineering/trip_runner2/setup.cfg
This solved it for me as well