简体   繁体   中英

Python Intended Block error

I am sorry but i have a problem that i dont understand...

def login_screen():
    print(30 * "-")
    print("   LOGIN")
    print(30 * "-")
    username = print("Please enter your username: ")
    password = print("Please enter your password: ")
        with open('logins.txt', 'r') as csvfile:
            loginreader = csv.reader(csvfile, delimiter=',', quotechar= None)
            for codes in loginreader:
                if len(codes) == L_LEN:
                    if codes[L_USERNAME] == username and codes[L_PASSWORD] == password and codes[L_ADMIN] == "Yes":
                        admin_console()
                    elif username == row[L_USERNAME] and password == row[PASSWORD] and row[L_ADMIN] == "No":
                        #Temp normal console here
                    else:
                        clearscreen()
                        error_head()
                        print("Unknown account")
                        input("Press [ENTER] To continue...")
                        login_screen()
                elif len(codes) != M_LEN:
                    next(csvfile, None)

So the problem is that it comes with the following error:

  File "G:\Python\DatabaseStandardRewrite\Login.py", line 49
else:
   ^

IndentationError: expected an indented block

But i dont get it! (Yes, all the other things are defined in the rest of the document!

Does anyone of you see my mistake?

Natan

Python does not permit blocks to be empty; you need at least one statement, and a comment does not count. So in the elif block before your else , you should put pass .

            elif username == row[L_USERNAME] and password == row[PASSWORD] and row[L_ADMIN] == "No":
                #Temp normal console here
                pass
            else:
                clearscreen()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM