i'm getting simple confusing error when trying create login worker via python.
here's error i'm getting.
traceback (most recent call last): file "stratixlogin.py", line 87, in <module> main() file "stratixlogin.py", line 78, in main login_worker() file "stratixlogin.py", line 51, in login_worker data = f.read() valueerror: mixing iteration , read methods lose datanter code
here error occuring:
with open("global_users.txt", "r") f: line in f: data = f.read() if data == username_ask: print(g+"success!") password_ask = raw_input(o+"password:"+w+" ") open("global_passwords.txt", "r") f: line in f: data = f.read() if data == password_ask: print(g+"success!") else: print(r+"incorrect password!") else: print(r+"no users found!")
i not sure error here, confused on how fix this. ideas?
you can't mix iterating through lines of file (the for
loop) , read()
.
enough:
with open("global_users.txt", "r") f: data in f: if data == username_ask: print(g+"success!") password_ask = raw_input(o+"password:"+w+" ") open("global_passwords.txt", "r") f: line in f: data = f.read() if data == password_ask: print(g+"success!") else: print(r+"incorrect password!") else: print(r+"no users found!")
Comments
Post a Comment