#885 Indenting errors when compiling python

closed-invalid
nobody
General (289)
5
2012-08-29
2012-08-29
boardstretcher
No

Geany 1.22
Python 2.7.3

Ive set the preferences in Geany editor to make tabs into 8 spaces, as many many many sites suggest to do. (Preferences -> editor -> indentation -> [Type = Spaces] [Width = 8])

However, when I try to compile some code, I get indentation errors.

Code:
print "hello"
print "hello2"

Result:
Sorry: IndentationError: ('unexpected indent', ('pythontest.py', 2, 8, ' print "hello2"\n'))

Pics attached of config and error.

Discussion

  • boardstretcher
    boardstretcher
    2012-08-29

    Preferences dialog

     
    Attachments
  • boardstretcher
    boardstretcher
    2012-08-29

    There is a tab worth of spaces before the second line (.......print "hello2")

    Sourceforge took out the tab spacing. Sorry

     
  • In Python every single indentation has a meaning, you can't indent a line differently from other lines in the same block. In the root scope (e.g. not inside any block) you can't indent at all.

    Also, the preferred ("official") Python indent is 4 spaces, no tabs ever.

    Ah, and you seem to speak of 2 attached image, but there is only one (the preference tab).

    And any way this is not a problem with Geany; it's either a problem with your code or Python's my_compile module (no chance).

     
    • status: open --> pending-invalid
     
  • boardstretcher
    boardstretcher
    2012-08-29

    • status: pending-invalid --> closed-invalid