-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mypy failing with invalid filenames #5326
Comments
Hi @AntonioL. Thanks for letting us know about this problem. Unfortunately I have not been able to reproduce the problem. I switched to a folder that has pipenv set up, set the interpreter environment to the local pipenv one, and enabled mypy in my settings. The extension prompted me to install mypy, which it did via pipenv. After that, I started getting the mypy messages in my "Problems" pane, as expected. So I'm not sure what the problem might be. If you didn't have mypy installed then the extension would prompt you to install it. If you did have it installed then you would see the errors. Here are a couple of things to check:
Thanks! |
Also I want to stress that:
Actually the issue seems to be specific to this project, but cannot troubleshoot further. I remember I had tried to recreate the pipenv environment and the issue did not go away. |
I have the same issue. I run mypy manually in the conda env and I see the problems I expect, but nothing is shown in editor, under problems or under mypy output: VS Code version: 1.33.1 |
Same problem here. The .mypy_cache folder is generated, but no result is shown in problems tab neither in the editor, so looks like the issue has something to do with VSCode being unable to retrieve its results... VS Code version: 1.33.1 |
The raw output from linter is not logged, making debugging this difficult. I am suspecting it's something wrong with the REGEX defined. @ericsnowcurrently did you try to reproduce with latest version of |
I had the same problem and it actually turned out to be a mypy issue that was completely silenced (which I think is the actual problem here - the mypy error is not shown in vs code). To figure out what's going wrong you can do the following (works on Linux and probably Mac, I don't know enough about Windows unfortunately):
#!/bin/sh
echo $@ >> /home/my_user/some_path/mypy_call.log
|
@harpaj That's a good idea. I don;t have the environment setup now. Could you share the log you got? Maybe it gives us hints. Thanks |
@harpaj Thanks for your idea. Indeed, letting it print the calling arguments and reproduce without the extension is a good and easy thing to do - I was only thinking that the extension didn't even execute FYI also, you can just change the |
Happy I could help! On a side note, to avoid such issues in the first and make mypy behave the same when being executed from VS code and externally, it might be a good idea to invoke mypy from the working directory and passing the relative path instead of the full path to it (no idea if that's possible). |
@harpaj I've just created a script for having the described behaviour. https://gist.github.com/yxliang01/b975fffa0b145d75ed1dba5b3a9ad960 Works well for me. But, in long term, I think the modification should be done in this codebase. Maybe we can create a new issue for changing this behaviour (execute with relative path)? I've just read the code. It's definitely possible (with potentially very few changes required). |
Anyways, just created PR #5834 which enforces the behaviour described in #5326 (comment) . |
@harpaj, @yxliang01, thanks for figuring this out. So, if I understood correctly, the following should happen:
I've opened issue #5850 for the first item. We'll keep the rest on this issue (I've updated the title). If there is anything else that needs to be done, please open a separate issue (to keep things nice and granular). |
@ericsnowcurrently Nice! But, would you like to clarify item 3? Why quoting is required? |
@yxliang01 @harpaj @AntonioL It's no longer reproducible for me, so I think the issue is fixed, closing this now. If it's not, please let us know and we can reopen it. |
Environment data
Expected behaviour
Have a virtualenv set up through pipenv.
I installed the following packages in my virtual env (obtained via
pipenv run pip freeze
:I have the following settings:
Actual behaviour
I am deliberately adding type errors
But nothing is reported under Problems for this project, I have another project with similar setup and it works.
I am running via cmdline mypy via pipenv and it definitely catches those.
My suspicion is that it is not calling mypy at all.
Steps to reproduce:
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)The text was updated successfully, but these errors were encountered: