I cannot use a shelve file (350 mb, .db) I am getting key error for an existing dictionary. I have checked .keys() and there is nothing ([ ]) so I have downloaded file and tried it on my own computer and my dictionary is in the file.
I cannot use a shelve file (350 mb, .db) I am getting key error for an existing dictionary. I have checked .keys() and there is nothing ([ ]) so I have downloaded file and tried it on my own computer and my dictionary is in the file.
I am sure that there is a key called 'done_dict'
File "/home/enisberk/App/paper_off.py", line 30, in <module>
done_dict= myShelvedDicts['done_dict']
File "/usr/lib/python2.7/shelve.py", line 121, in getitem
f = StringIO(self.dict[key])
File "/usr/lib/python2.7/bsddb/init.py", line 270, in getitem
return _DeadlockWrap(lambda: self.db[key]) # self.db[key]
File "/usr/lib/python2.7/bsddb/dbutils.py", line 68, in DeadlockWrap
return function(_args, *_kwargs)
File "/usr/lib/python2.7/bsddb/init.py", line 270, in <lambda>
return _DeadlockWrap(lambda: self.db[key]) # self.db[key]
KeyError: 'done_dict'
I don't know what was the problem but I have killed all consoles and logged out and logged in again, finally now everything looks fine. I am waiting for result.
I'd never heard about shelve files until today! Intriguing.
You say .keys() is empty on PythonAnywhere. Is it also empty on your own PC?
Also, could there be some sort of path error? Try entering the full path to the shelve file when you load it? eg /home/username/folder/filename.db?