I am writing a program to check the user id from a file. But when i run the program, it just runs the first print statement and gets stuck there:
print ("Hello!")
print('Would you like to Login or Create an Account?')
choice = input('(Create Account/Login)')
#For creators of new account
if choice.casefold() == "create account":
with open("credentials_dict.txt", 'a+') as file:
line = file.readlines()
#Entering User ID
print("User ID Should be 3 to 6 Alphanumeric characters")
uservalidity = False
while not uservalidity:
for line in file.readlines():
userid = input('Enter User ID')
check_user = checkuserid(userid,line)
if check_user:
print ("Valid Username")
uservalidity = True
else:
print ("Incorrect Format or UserID exists")
The output is:
Hello!
Would you like to Login or Create an Account?
(Create Account/Login)Create Account
User ID Should be 3 to 6 Alphanumeric characters
The error message when i end the execution abruptly: File "C:\Users\mahev\Downloads\Python Files\Login_application.py", line 57, in for line in file.readlines():
File "C:\ProgramData\Anaconda3\lib\encodings\cp1252.py", line 22, in decode
def decode(self, input, final=False):
That's it the program doesn't progress further. Any pointers?