I’m following the recent Python Tutorial for Beginners (with mini-projects). So my settings are set up just as Dave’s at 29:25, I did everything just like him (except I’m on Mac and not Windows), and when I save or try to manually format the document it isn’t formatting anything, nothing changes. Can someone please help?
Can you clarify what you mean by “manually format”?
right click/control and ‘Format Document’ or ‘Format Document With…’ where I then pick python for the latter
sorry for confusion
Here is the video for reference: https://youtu.be/qwAFL1597eM?t=1476
Did you install the “Python VS Code extension” from Microsoft? And if you select ‘Format Document With…’ does it give you the option for ‘Python’ under “Select Formatter?”
In this video he also shows how to display the settings json file. Can you copy the contents of that here (Or just check under the Python section?)
addendum: maybe even just skip this part, not a huge fan of installing an auto-formatter first thing in a beginner’s course about Python where formatting is so important, in fact a major feature of the language
Yes, I have the extension and python does come up when I do “Format with…”. Also copied his settings.json file.
When would you recommend to start using auto formatting?
Nothing changes when you select “format with Python” ? Do you definitely have formatting problems? Is it possible it’s already correctly formatted?
Yes nothing changes.
I did the same thing as Dave in the video and put an indentation where there shouldn’t be one, and when I save or format with python, nothing changes like it does for him
Try removing and re-installing the Python VS Code extension.
The good news is, it won’t stop you from completing anything I think you will just learn Python formatting better
hmm re-installing doesn’t seem to work:( thank you for the tips tho, and good to know this can help me learn better!
Hi, Ive just had the same issue. Im not sure how its successfully removing the spaces before line04 in Daves example, when I try it does nothing. It also prompts to use either Black or autopep8 as the formatter. I ended up installing Black and setting that as the default. Opening the Output window for Black I could see it complaining “Skipping non python code”. Basically the formatter is working but it’s not seeing the spaces before line04 in Daves example as python code so its doing nothing. If you were to put a bunch of spaces between ‘line04 =’ and “*****” it will reformat ok.
I am also encountering the same issue. Both autopep8 and black formatter does not work.