Well, I'm developing an application (in kivy) in which user validation is required, so I made a function that will read the .txt file to find the user, if the user is in the file it will be possible to login, if not, not it will be possible. The script in python looks like this:
def login(self):
user = self.root.ids.user.text
password = self.root.ids.password.text
arq = open('arquivo.txt','r')
count = 1
while count == 1:
for line in arq:
line = line.rstrip()
if user in line and password in line:
print('You are CONNECTED')
count += 1
if user not in line and password not in line:
print('Login Error!')
count -= 1
arq.close()
The login is working normally, however, when I type a nonexistent user or the incorrect password, the application dies and locks my terminal. Do you wonder why?
In the first two lines it is written "Você está LOGADO" which is the same as 'You are connected' but in Portuguese. On the third line, which would be the wrong user simulation, the application died.