Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Indentation Issue
-
Hi all, I am editing a program in Notepadd++ and then mailing myself the .py file. Once open in Pythonista I seem to have issues with the indentation. In the setting i turn on soft indentiation and set tab equal to 4 spaces. Then I try to convert the indentiation, but I get the error shown below the question. When I try to run the program i get an indentation error message in a place where I wold not really expect one.
Does anyone have any tips for how to solve this, but more importantly how to avoid these types of issues.
Normally I would be happy to write the code directly to pythonista, but that is not as feasible to do when there are collaborators...Thanks
Error: Traceback (most recent call last): File "/var/mobile/Applications/E4A601AC-A113-4B37-96DF-206D1D61BB3A/Pythonista.app/pythonista_reindent.py", line 111, in main check(arg) File "/var/mobile/Applications/E4A601AC-A113-4B37-96DF-206D1D61BB3A/Pythonista.app/pythonista_reindent.py", line 157, in check if r.run():
-
i'm a newbie and run into this all the time, it is kind of frustrating when you are learning and it makes no sense because to me, it looks correct.
-
There is an option in the Action Menu of the current Pythonista called Convert Indentation that can fix this issue. In Pythonista Settings, you can set tabs equal to 4 spaces and turn ON both Soft Tabs and Show Mixed Indentation. Then you can select Convert Indentation on the current script an it will do the right thing.
-
Notepad++</br>
Settings -> Preferences -> Tab Settings -> Tab size: 4 and check "Replace by space" -
thanks CCC and Brumm!