Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ indentation messes up

I'm coding in Python and I really like Notepad++. However, off late when I use tab to indent, it seems fine in Notepad++, but when I run the program I get an indentation error, and when I check my code in Emacs or something, I find that Notepad++ actually adds more tab spaces than it shows on screen. What is happening?

like image 645
iman453 Avatar asked Jul 29 '10 20:07

iman453


People also ask

Why do I keep getting indentation error?

The indentation error can occur when the spaces or tabs are not placed properly. There will not be an issue if the interpreter does not find any issues with the spaces or tabs. If there is an error due to indentation, it will come in between the execution and can be a show stopper.

When there is an incorrect indentation it raises?

If there is an incorrect indentation, this will result in an error, and the python interpreter will just return an error function. It uses the PEP8 whitespace ethics. There should be 4 whitespaces used between any alternative or iteration.


1 Answers

There is no universal tab size, so I always make sure to replace tabs by spaces (so you know what you see is what you get everywhere else as well)

Go to Settings -> "Preferences..." -> Language Menu/Tab Settings and check 'Replace by space'

like image 127
ikottman Avatar answered Oct 12 '22 14:10

ikottman