Need help with possible problem

I am getting a NameError saying that my name is undefined.
def checklogin():
global loginUI
loginUI = Tk()
text=“Login by putting in your username into the console.”).pack()

global tempuser
global checkuser
tempuser = input("What is your username?: ")
usernames = open("usernames.txt", "r")

for line in usernames:

    if line == tempuser:
        checkuser = True
        checkuser = False

if checkuser == True:
    print("Incorrect Username!")

For some reason, even though this worked before, it just doesn’t seem to work anymore. FYI i am using Replit. It may be a problem with the website but just need some insight.

Don’t be shy, tell us which name is undefined.

Please copy and paste the full traceback, starting with the line
“Traceback…” and ending with the NameError and error message.

Also, your test for a username won’t work, because the lines you read
from the file will end with a newline but the username you get from the
user won’t.

The best way to solve that is to add a line inside the loop:

for line in usernames:
    line = line.strip()

I figured out what it was. For some reason the website got rid of my text in my .txt files so it wasn’t reading anything. Idk what the hell it was but thanks for the help.