AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Visual studio fix indentation4/30/2023 ![]() Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread If the answer is helpful, please click "Accept Answer" and upvote it. if you do report this issue, please share the link here, other forum members who are interested or meet the same or similar issue can go to vote for this thread. I suggest you can start a new thread and report this issue to VS Product Team in our Developer Community with some reproduced or detailed information. Obviously, the Python Interactive window treats the line where the unpack operator is located as the beginning of new code. ![]() When you manually enter the code, it can run correctly regardless of whether the code contains an unpack operator, but when the code contains an unpack operator, copy and paste the code and then run it will cause an error. You can try to create a new project to run this code.Īccording to your statement, I read this document and tested it, and I found this result: I successfully ran your code in Visual Studio 2017, whether it is four spaces or a Tab, it runs successfully. Does anyone know what's causing the unexpected indent error in the VS Python interactive window? Thanks for any info! To top it off, when the code with the unpack operator is executed in a windows command prompt, it works perfectly! I.e., save the python snippet as TestUnpack.py, then type "py -m TestUnpack" in a windows command prompt. I've tried None, Block, and Smart for indenting options, and both Insert Spaces and Keep Tabs for tab options, nothing fixes the error. This results in the following output: j = 0Īll the indents are consistent, either 4 blank spaces or a tab of length 4. The code differs from the above only in the insertion of an asterisk before mylist in the print statement: Then I decided I wanted the output of mylist to be just a list of space-separated integers (no commas or brackets), by using the unpack operator (*). ![]() First I'll show the code that works as expected: I'm trying to execute a short snippet of python code in the VS 2017 Python Interactive Window.
0 Comments
Read More
Leave a Reply. |