So I wrote a program in python using NotePad++ in Windows, but then when I opened the file in Mac computer using TextWrangler or any text editor in it and after compiling it, there was an error message regarding indentation. How can I easily fix this?
Asked
Active
Viewed 158 times
0
-
1Provide code snippet for which you are getting error along with the error message. I think you mixed tabs and spaces in your Python code. See [this](http://stackoverflow.com/questions/119562/tabs-versus-spaces-in-python-programming) SO question. You can convert all tabs in your code to spaces in [TextWrangler](http://stackoverflow.com/questions/5750361/auto-convert-tab-to-4-spaces-in-textwrangler). See the [explanation](http://stackoverflow.com/questions/2034517/pythons-interpretation-of-tabs-and-spaces-to-indent) why tabs and spaces are different. – vaibhaw Apr 04 '14 at 06:11
1 Answers
1
Here is something to do with your file via Notepad++:
Edit -> Blank Operations -> TAB to Space
If this won't help (and most likely it won't) you will need to check indents manually. I can suggest View -> Show Symbol -> Show Indent Guide
for convenience.
It is a good and safe style to use only spaces. Not to face this problem in your future projects configure Notepad++: Settings -> Tab Settings -> Replace by space
. You will still be able to use tabs, but they will be changed to defined number of spaces (4 for me). Hope this helps.

arbulgazar
- 1,931
- 1
- 19
- 24