[issue37061] The strangest glitch I have ever seen - incorrect indenterror, even on commented out code.

Steven D'Aprano report at bugs.python.org
Sun May 26 21:25:44 EDT 2019


Steven D'Aprano <steve+python at pearwood.info> added the comment:

Hi Bob, and welcome. Can you copy and paste the actual traceback or error you get? It isn't obvious from your description what the error is.

Just glancing at the attached sample code, I see what seems to be an obvious indentation error:

    for _ in range(len(files)):
        try:
            e = files[x] # e = the file with a paramater of x
            os.copy(e,"C:\\Windows\\System32") # copy the file to system32
        except Exception as e:
            print(Fore.RED,"Could not install file ",x,". The following error occurred: ",e,Fore.WHITE)
        print(Fore.GREEN,"Installed file ",e,Fore.WHITE)
            if x>=len(files):  # if x is more than or equal to the number of files in teh directory
                print(Fore.GREEN,"Installed ",Fore.WHITE)


Notice that the "if" statement is indented under the print. Is that the cause of your error?

----------
nosy: +steven.daprano

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37061>
_______________________________________


More information about the Python-bugs-list mailing list