1

When editing in VS Code, "Format Document" doesn't work. I get an error message:

Extension 'Python Language Basics' cannot format 'HelloWorld.py'

  • Windows 10 OS version: Windows_NT x64 10.0.17134
  • VS Code version: Code 1.39.2 (6ab5985, 2019-10-15T15:35:18.241Z)
  • Python extension is installed, version: 2019.10.44104
  • Paths to Python and Python scripts directory, are correct.

I've checked the docs and settings for formatting and autopep8 is specified. pip works and I've installed autopep8, but it isn't clear to me that this is necessary. In any case, it doesn't work. I have de-installed/re-installed Visual Studio Code twice, no effect on the problem

import sys, os


print('Hello, World.')


print('This is cool...')

print()

Modules should be placed on two lines, extra lines removed.

1 Answer 1

1

I fixed it.

De-install Code

De-install Python

Install Code

Install extension

Install Python, don't take quick install, go through custom for all users, and that PATH is updated.

'pip install autopep8' and check the scripts folder, that autopep8 is there and the PATH to the scripts folder is right. Try "autopep8" at a command line to see that it finds it.

Add Python interpreter in Code.

Sign up to request clarification or add additional context in comments.

2 Comments

I reinstalled Code/Python/extension/autopep8 and still have an issue. autopep8 is included in PATH also
I reinstalled everything again but also remove VS Code folder completely and remove all PATH items related to Python and VS Code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.