Steven D'Aprano <steve+pyt...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue37061>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to