The main problem is that after inputting a login program just returns me back instead of working with row in my sorted dictionary. I have a function, that created for registration, Previously I worked with it because I have the full program with autorization and registration. Now I need this function again for another program with autorization, but it doesn't working (but it worked...)
here is my function:
def reg(r) -> None:
loginnn = input_str("Create login:\n", "login must be made of 4 - 20 symbols")
with open("hashpy.csv") as f:
reader = csv.DictReader(f, delimiter=',')
sorted_dict = sorted(reader, key=lambda k: k['login'])
for row in sorted_dict:
#don't worry about code below, it's still under 'construction'
login, password, salt, role = row:
passworddd = input_str("Create password:\n", "password must be made of 4 - 20 symbols")
salt = uuid.uuid4().hex
print(salt + "salt")
passworddd = hashlib.sha256(password.encode() + salt.encode())
print(passworddd)
print("Registraion is succeed!")
with open(file_name2, 'a') as f:
f.write(f"\n{loginnn},{passworddd},{salt},{r}") # r == role (r is an argument)
return
I used debugger and I saw, that everything is good till program compiling this line:
sorted_dict = sorted(reader, key=lambda k: k['login'])
which returns me sorted_dict []
After this line program just returns to
with open("hashpy.csv") as f:
with 0 changes
and then returns me back to menu.