I'm getting this message
There is no document formatter for 'python'-files installed.
When I try to format a Python
file on Visual Studio Code
.
I tried to install some packages (autopep8
, pep8
, pycodestyle
), but they didn't help. What's going on?
More than likely you installed autopep8
into a different interpreter/environment than you one have selected in VS Code. If you remove your formatter settings from your settings.json
and then try formatting again, you will get prompted to choose and install a formatter (either autopep8
, yapf
, or black
).
I had the same problem, but I was using Prettier. Thus it doesn't support python properly or vscode doesn't recognize it as python formatter.
I installed autopep8 for python in extentions bar. Then I configured the settings.json
for user and workspace settings.json
:
user settings:
"[python]": {
"editor.formatOnType": true,
"editor.defaultFormatter": "ms-python.autopep8"
},
workspace-settings:
"folders": [
{
"path": "."
}
],
"settings": {
"git.ignoreLimitWarning": true,
"python.defaultInterpreterPath": "path_to_your_project",
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
}
},
And it worked!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With