PDA

View Full Version : indentation error ????



vbk!!!
04-15-2015, 07:40 AM
It seems Lightwave don't like "tab" indentation.


When I use the "tab" key to make my indentation, lightwave always return an error. i have to use the spacebar to make it.

It sucks.

I never meet this kind of thing before.


What about you guys ?

ernpchan
04-15-2015, 08:42 AM
What do you use as your editor?

Ryan Roye
04-15-2015, 08:56 AM
What about you guys ?

I have. You have to use either spaces or tabs to "group" things in Python. As far as I know you cannot mix-match tabs and spaces, you have to use one or the other for the entire script. If you expect your script to be very long and complicated in terms of code, use spaces instead of tabs as it'll keep things from getting pushed ridiculously far to the right.

Also, I recommend a text editor that can display the difference between spaces and tabs when you highlight them with the cursor. I recommend Sublime Text 2 (http://www.sublimetext.com/). While this is a commercial editor, it has an unlimited trial period so you can evaluate its full feature set and work with it at your convenience before determining whether its right for you.

vbk!!!
04-15-2015, 01:37 PM
I use Notepad++
I will try to find another editor
thanks

iain_r
04-16-2015, 05:42 AM
Hi, I use Notepad++ and have changed my preferences so that when I hit TAB I get 4 spaces. In Notepad++ from the menu Settings->Preferences->Tab Setttings , leave on default there is a check box at the bottom which will replace the tab with 4 spaces.

Regards

Iain

vbk!!!
04-16-2015, 06:14 AM
thanks for the tip

SirLightwaver
04-27-2015, 08:09 AM
It might be a little bit offtopic, but there is another reason for the "indentation error" to occur:
You cannot leave a block empty. Instead you will have to use the pass command:

An example:
def functionThatDoesNothing():
___pass

Remark: _ represents a space