matangover/mypy-vscode

[Errno 2] No such file or directory

coccoinomane opened this issue · 11 comments

Hi @matangover and thank you for this great extension... it really makes my work easier :-)
I would like to report a weird issue: since yesterday I started seeing this error everytime I modify a Python file in my workspace, with or without a mypy file: [Errno 2] No such file or directory.
Here is a screenshot of the error and of the "Output" tab.
Thank you!
Guido

Markup 2022-01-08 at 17 38 16

Hi @coccoinomane, I'm happy you like the extension. Let me try to see why it's failing this way...

  1. Did you recently upgrade or re-install mypy or Python?
  2. Does this error happen with any workspace or just with this specific one?
  3. Do you have Python installed at /usr/local/bin/python3?
  4. Can you check the log file, which is the one following the --log-file argument in the Output panel?

Hi there @matangover , and thank you for your reply!
Here you go:

  1. Yes! This is my first project with mypy, I am on version dmypy 0.931. I have removed & re-installed mypy to no effect.
  2. I get the same error even on a workspace with just an empty test.py file.
  3. Yep, my python is in /usr/local/bin/python3 and is version 3.9.9
  4. The log file exists and is empty, with permissions -rw-r--r--. Changing them to 777 does not fix the problem.

Let me add that the .json file exists too and has the following content:

{"pid": 1788, "connection_name": "/var/folders/dx/t_4v7kfd1pb_fy5lmq1s60gc0000gp/T/tmp4zvqbzam/dmypy.sock"}

The dmypy.sock file does not exist though, maybe this is the problem?

Cheers,
Guido

As a follow up, I can confirm that the problem is the non-existing socket file.
If I create an emtpy dmypy.sock file where the editor expects it, I get a different error:

Error running mypy in /Users/coccoinomane/code/web3/crabada: mypy failed with error: "[Errno 38] Socket operation on non-socket". See Output panel for details.

Thanks for the details. I will try to reproduce the problem

RayBB commented

I am also seeing this issue but can't pin down any specific cause. When I clone the (private) repo to a different new folder it doesn't happen anymore.

I checked diff -qr ~/api api | grep -v .git and removed everything that was different except secrets files and no luck.

Edit: I moved the folder that was having the issue elsewhere, copied the folder that had pretty much no diff. Now all of a sudden it's working. I can only guess it had to do with something in .git or some other temp file.

Another user with the issue here. When I look at the output pane for details, all the files in the command line exist. This started happening maybe a couple of weeks ago?

Thanks for reporting everyone, I'll try to reproduce it. What mypy versions are you using? I have a feeling it might be related to dangling daemon processes that are not properly closed in some occasions.

@matangover I have:

> dmypy --version
dmypy 0.812

And I think you're on the right track: I closed all my VSCode windows, killed all the dmypy processes on the host, restarted VSCode and I'm not getting complaints anymore \o/

We have the same issue! :(

I've released a new version which fixes the bug. If for any reason you still encounter this error please enable the mypy.debugLogging option and attach the log.

RayBB commented

For anyone who is still getting crashes. Upgrading to the latest version of mypy 0.910 -> 0.931 seemed to fix this (or a similar) issue for me.