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.
Pythonista indent vs Tab
-
If I am editing a Pythonista file (.py) in Xcode, what key on my Mac is used to properly indent?
When I use Tab on the Mac keyboard I get an error at run time. When I copy and paste the Pythonista indent it runs.
I thought the indent was tab?
-
Hit the spacebar four times.
-
Depends on what you've been using in Pyhonista as the indentation method. Compare the indentation settings of Xcode and Pythonista and make sure that they are the same.
-
4 space bar hits does the same thing...
-
Pythonista is set to "2 Spaces". Here are my Xcode settings, what should I change? When I set Xcode indent to 2 spaces it still has an error. Hmmm
-
Does your Pythonista use soft tabs (n spaces) or hard tabs (the actual tab character, as in
"\t"
)? That needs to be configured in Xcode as well (first dropdown menu on the settings screen you posted). -
In Pythonista, Settings, Indentation, turn on both
Soft Tabs
andShow Mixed Indentation
as they will save you a lot of grief on the iOS side.In Pythonista, Settings, (you might have to scroll down) Action Menu, turn on
Convert Indentation...
. Then open the file in question and selectConvert Indentation
from the Action Menu (thewrench
icon).Read the first few links at http://google.com/search?q=tabnanny
On the Mac side, run Applications/Utilities/Terminal and
cd
into the directory where your Python files are and then typepython -m tabnanny -v .
(that final period is important) to see where your indentation issues are. Use the spacebar, (not the tab key) to fix up the offending lines by deleting all leading whitespace and then pressing the spacebar until the text is where you think it should be. Rerun tabnanny.