I am trying to format my Python code automatically using the format on save feature in vs Code.
I have installed the autopep8
package and added the following configuration to my pyproject.toml
file:
[tool.autopep8]
in-place = true
aggressive = 2
when I try like autopep8 test.py
it is working. However, when I try to format my code using the format on save feature, I get the following error message:
--in-place cannot be used with standard input
How can I resolve this error and format my code using autopep8
with desired options?
and my vs code settings looks like:
// Python
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8",
},
"python.formatting.provider": "none",
2
Answers
You can change your settings like the following codes:
You can read document for more detials.
Davood, Go ahead and create a .vscode folder in the root of your project. write a settings.json file in there and add the following configuration:
Hope this helps pal, happy coding!!