So I have been having issues with my VSC and python 3.7 It works when I try to run the code through Sublime and terminal, and seems to fix itself after I restart visual studio, but always returns within 10 minutes or so.
When i write code in python, automatic indents are not correct. The program as well as compiler, when I try to run it in terminal, complain about it. (As seen in picture 1) However, even when I try to manually change it to the correct position, compiler and VSC complain and do not let me compile it because of unexpected indentation. (As seen in picture 2)
I have reinstalled VSC a few times because of this issue, I have freshly reinstalled macOS Mojave, and I have reinstalled python 3.7 and extensions for VSC. The problem resolves itself for a little bit if I restart the program, but I would rather not have to restart the program every other time I need to indent things in python (where indentation is rather critical)
When my brother, who is a windows user, copies my code to his VSC, it does not show the same issue, so I'm completely lost as to what to do.
\t
character present) while yourelse
block has five spaces (the default number of spaces when a tab\t
character is present). So you probably want to check the settings forEditor:Insert Spaces
(as noted in the current given answer) is marked (so you get ex. four spaces rather than a tab\t
character when you pressTab
).\t
characters in the line won't fix the issue. You have to delete any "blank" characters before the start of the code and insert the proper number of spaces (or whatever) yourself. Moreover, you can only use tabs or spaces for indentations in the entire script. Regarding importing code, I am guessing your brother likely has an option to convert tabs to spaces automatically set, which would eliminate this problem when transferring the code itself.