Opened a ticket with AutoPep8, but when I installed the autopep8 extension, it doesn't seem to find the module. When I change the config to tell it where it is a format doesn't do anything. Formating in terminal does however. Any ideas? https://github.com/hhatto/autopep8/issues/349#issuecomment-335662565
-
Can you show a picture of what is happening? What are you wanting from the formatting?ifconfig– ifconfig2017-10-11 04:15:02 +00:00Commented Oct 11, 2017 at 4:15
-
1Have you tried the default Python extension yet?ifconfig– ifconfig2017-10-12 15:19:49 +00:00Commented Oct 12, 2017 at 15:19
-
Got a 404 on that linkDan Quackenbush– Dan Quackenbush2018-02-12 23:36:40 +00:00Commented Feb 12, 2018 at 23:36
-
1Updated link: marketplace.visualstudio.com/items?itemName=ms-python.pythonifconfig– ifconfig2018-02-13 03:22:17 +00:00Commented Feb 13, 2018 at 3:22
-
I installed that and I get the same result. Also it warns that its not a recommended interpretor.Dan Quackenbush– Dan Quackenbush2018-02-15 02:07:25 +00:00Commented Feb 15, 2018 at 2:07
|
Show 3 more comments
5 Answers
Install the below python packages for Python Code Format supporting in Windows
pip install autopep8
pip install pylint
Once you have successfully installed the packages, Open the code in vs code -> Press Ctrl + A and Ctrl + K, it will format the code.
1 Comment
J.R. Bob Dobbs
This did not work for me. However, after running this command, I also went to the extensions of VSCode and installed the "autopep8" extensions. I then updated my user settings json file with "[python]": { "editor.defaultFormatter": "ms-python.autopep8"} and now VSCode is formatting my python code. This is on a mac, if that matters to you
autopep8 is listed as a requirement. On mac, using brew, you can install it as follows:
brew install autopep8
2 Comments
J.R. Bob Dobbs
This did not work for me. However, after running this command as well as the commands of
pip install autopep8 and pip install pylint I installed a VSCode extensions called "autopep8". I wrote more specific instructions for making it work in a comment to an answer by @Dhandapani Sudhakar on this page you're currently onYou can use Ruff, it is suggested in the official VSCode documentation. Among their suggestions, it is the highest-rated community extension. Once installed, simply press
(CTRL or COMMAND) + ⇧ + i