+ 1
I tried copying one of my older codes from the Playground into Wing IDE, and it returned a TabError.
https://www.sololearn.com/en/compiler-playground/cE0qvuUCd2qL Wing IDE gave me "builtins.TabError: inconsistent use of tabs and spaces in indentation (Skyrim character generator.py, line 16)". The code works with no issues in the Playground. What happens? (I didn't copy the docstrings, just the code.)
13 ответов
+ 5
The standard is 4 whitespaces so you may have to rework each line carefully to remove each IndentionError .. also 4 years ago we ( sololearn ) had a different editor if I recall 🤔
+ 3
WingIDE is not bad, but I'm using VSCodium (with some visual extensions, like: indent rainbow; if there is an indentation problem, I will see it....). completely free, open source, telemetry free....
give it a try, I have changed some editors and ides because of this one.
VSCodium uses monaco-editor, which is included here ad well....
about TabError:
for instance: you are using 4 spaces for indentation, but the tab uses 8 spaces....
+ 2
OK let's say I create three ... whitespaces as an indentation and then I tab which is suppose to be equal to three whitespaces but it is 2.75 whitespaces not actually 3
Or say we end a line with the cursor and it appears to align where we need it without having to back up and start from the beginning of the line as an auto tag.
+ 1
https://www.sololearn.com/compiler-playground/cE0qvuUCd2qL
Sololearn Playground might be forgiving: Some online playgrounds might automatically convert tabs to spaces when you paste code. This explains why your code works here despite potential mixed indentation.
Wing IDE is stricter: Wing IDE, being a full-fledged IDE, enforces consistent indentation. It detects the inconsistency in your code (likely mixing tabs and spaces) and throws the "TabError" on line 16.
the error is somewhere close to here
if g=="Female":
if you used tab verses just single whitespaces in the indentation it may have an issue not necessarily visible by us or on sololearn.
+ 1
replace tabs with spaces for indentations.
The problem with tabs and spaces is while they look the same, they are different when parsing. In indentation dependent codes like Python, some IDEs makes the distinction between a single tab character and 3 or 4 spaces. The recommendation is to use spaces instead of tabs in Python to avoid problems like these. Open the preferences of your IDE and look for an option to replace tabs with spaces. This way, even if you press tab, the IDE will actually replace the '\t' with your preferred number of spaces.
+ 1
Bob_Li my IDE has three options for indentation: spaces only, tabs only, and mixed tabs and spaces. I tried all three options, each time running the code gave the same error at the same line. So it seems that the IDE is parcing spaces and tabs the same way anyways.
I'm starting to doubt that manually rewriting all indentations would solve the error.
+ 1
Mihaly Nyilas i will look into VSCodium, thank you.
+ 1
BroFar i see. I will rework the code tomorrow, since it's getting late here. Thank you for tips!
+ 1
Have you tried using flake8 Igor Matić
pip install flake8
0
BroFar i don't understand. It's the same code.
0
BroFar i wrote the code on my phone, years ago. I didn't have a PC back then. I don't remember the app having tabs, so i was just using space 4x to indent a code block.
So, now i would have to replace indentations with tabs?
0
Igor Matić
I'm not familiar with Wing IDE, but after a peek at their site, I can't say I'd be trying it any time soon. I'm sure there are better options.
0
Hi guys