What I have is 3 dictionaries dumping with pickle to 3 different files. I had originally just written a read and write function for each file so a total of 6 functions. So last night I tried to make it so I would only have to use 1 read function and 1 write function. I got the write function to work but the read function is not. I have been looking since last night for a solution to this problem and I am fed up so any help you can give I would appreciate. I am new to programming/python if you could not tell. Here is the code I'm using:
w = {} # would be past in as source
def writing(filename, source):
with open(filename, 'wb') as st:
pickle.dump(source, st)
def reading(filename, source):
with open(filename, 'rb') as st:
source = pickle.loads(st.read())
reading('test.txt', w)
The error I got is:
Traceback (most recent call last):
File "./database.py", line 303, in <module>
pw.check_pwd(p)
File "./database.py", line 47, in check_pwd
if self.pwds[self.user] == hashlib.sha512(self.pwd + self.salt).hexdigest():
KeyError: 'Codex' this was the error I was getting sorry for the bad post