indent

Asked by Linus Holmeros

def LoggFileHandler(logg):
     Append2LoggFile("entering LoggFileHandler("+logg+")")
     if firstTime == 0:
         if os.path.isfile(LoggFile): #check if logg file exists
              os.remove(LoggFile) #delete if first time program runs
              Append2LoggFile("removed old logg file")
              Append2LoggFile(" ")
              CreateLoggFile() #create new logg file
              Append2LoggFile(logg)
         else:
             CreateLoggFile() #if not found create new
             Append2LoggFile(logg)
     else:
          Append2LoggFile(logg)

This code gives me an dedent error at the last else:
I cant make it right...

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Linus Holmeros
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

- select all the lines of the def
- type shift-tab until all lines are left justified
- then line by line or in blocks use tab to restore the correct indentation

Revision history for this message
Harry Readinger (temporary22) said :
#2

i fixed the actual indentation here:

def LoggFileHandler(logg):
    Append2LoggFile("entering LoggFileHandler("+logg+")")
    if firstTime == 0:
        if os.path.isfile(LoggFile): #check if logg file exists
            os.remove(LoggFile) #delete if first time program runs
            Append2LoggFile("removed old logg file")
            Append2LoggFile(" ")
            CreateLoggFile() #create new logg file
            Append2LoggFile(logg)
        else:
            CreateLoggFile() #if not found create new
            Append2LoggFile(logg)
    else:
            Append2LoggFile(logg)

Your spacing Looked like this initially
<tab>(xTimes)<space><space>
personally I have my editors (sikuli does this as well) replace all "tabs" with 4 spaces, and never intermix my own spacing.

Revision history for this message
Linus Holmeros (linus-holmeros) said :
#3

Thanx

I might have intermixed 4 spaces and tabs when using notepad++