Closed jensenja closed 1 year ago
@jensenja The errors on Python extension are from python extension probing the various python installs it finds on your system. You don't need to do anything in particular as long as your flake8 extension is running and working.
You only need to set flake8.interpreter
if you want to use a specific interpreter for that particular extension. This setting is there for the rare cases where users want to use custom pythons. Also, to set relative paths, you can use ${workspaceFolder}
as a variable to represent your project, and you can use relative pathing from that.
But, based on what you have shown in the logs, you don't need that setting.
FYI, If you want to try out a faster version of flake8 try ruff
, whihc also has a similar extension in the VS Code marketplace.
Thanks @karthiknadig -
The errors on Python extension are from python extension probing the various python installs it finds on your system. You don't need to do anything in particular as long as your flake8 extension is running and working.
Understood - so I take it that the error messages regarding the Python extension not being able to stat
files for Flake8 are cosmetic?
You only need to set
flake8.interpreter
if you want to use a specific interpreter for that particular extension. This setting is there for the rare cases where users want to use custom pythons.
That's right - As I'd mentioned I'm working on a Python monorepo that's using Pants so I'd like to be using the same version of Flake8 that comes bundled with it, hence me exporting its included version of Flake8 as a virtual environment, and then pointing the Flake8 extension to use that. This seems to work perfectly fine with Black/MyPy/isort - Flake8 is the only extension that seems to be causing the Python extension to spit out these errors.
Python extension not being able to stat files for Flake8 are cosmetic?
That is correct. You can ignore those errors.
Great - thank you @karthiknadig - I'll go ahead and close.
I'm running VSCode on my M1 Mac and using the remote extension to connect to a Linux laptop. VSCode information:
I have a workspace
settings.json
with the following contents:The virtual environments are set up by Pants. In the output logs for the Flake8 extension, I get a couple of errors but things seem to start up fine:
But - I do get errors in the "Python" output:
Now - those errors go away (in both the Python extension output as well as the Flake8 extension output) as soon as I change
flake8.interpreter
in mysettings.json
to the full absolute path of the Python interpreter in myflake8
virtualenv:EDIT: I get the errors in both extensions if i also set
flake8.interpreter
to a relative path from the repository root, ie:Since this is intended to be workspace settings (and are checked into my repo) this obviously isn't ideal - can someone point me in the correct direction of how to resolve this?