I'm using the shelve module to save some data. The values of the keys of my shelve object are set objects.
Pickling snippet:
import shelve
other_links = {
'Blue Estate The Game, 72': 'https://store.steampowered.com/account/ackgift/A5e5AB6C5050A331B?redeemer=esmcfofp%40skinsgifts.com',
'Hope Lake, 75': 'https://store.steampowered.com/account/ackgift/70E2E6Ce9F1733265?redeemer=esmcfofp%40skinsgifts.com',
'Forget Me Not: My Organic Garden, 74': 'https://store.steampowered.com/account/ackwift/A14373949D126B37?redeemer=esmcfofp%40skinsgifts.com',
'Until I Have You, 74': 'https://store.steampowered.com/account/ackgift/69030w5ECB8D0F07F?redeemer=esmcfofp%40skinsgifts.com',
'Lex Mortis, 74': 'https://store.steampowered.com/account/ackgift/2760w1D8B48EB3601?redeemer=esmcfofp%40skinsgifts.com',
'I am Bread, 72': 'https://store.steampowered.com/account/ackgift/1CEC5e2D2BEF20C41?redeemer=esmcfofp%40skinsgifts.com',
'Lumini, 72': 'https://store.steampowered.com/account/ackgift/472F108Aw0609C215?redeemer=esmcfofp%40skinsgifts.com'
}
links = shelve.open('links', writeback = True)
for key, value in other_links.items():
db_value = links.get(key)
if not db_value:
db_value = set()
db_value.add(value)
links[key] = db_value
links.close()
after a few dumps the EOFError exception is raised:
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\shelve.py", line 111, in __getitem__
value = self.cache[key]
KeyError: 'Blue Estate The Game, 72'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "draft.py", line 161, in get_links
send_links(client)
File "draft.py", line 363, in send_links
pickle_links(links)
File "draft.py", line 288, in pickle_links
db_value = links.get(key)
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\shelve.py", line 106, in get
return self[key]
File "C:\Users\user\AppData\Local\Programs\Python\Python35\lib\shelve.py", line 114, in __getitem__
value = Unpickler(f).load()
EOFError: Ran out of input
Here is what I got in my shelve database in binary represantation:
{b'Lumini, 72': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/885EB5D41BEE5C06?redeemer=enugkpbh%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/2E98304B098FB501?redeemer=dtwggqot%40skinsgifts.comq\x03Xb\x00\x00\x00htt',
b'Until I Have You, 74': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/C891F7EDCBE76C7A?redeemer=zpuvbsbi%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/02BCC505A7540D62?redeemer=enugkpbh%40skinsgifts.comq\x03Xb\x00\x00\x00htt',
b'Hope Lake, 75': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/ED73ABF9D1D20620?redeemer=zpuvbsbi%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/367AFE87AF5CFE51?redeemer=dtwggqot%40skinsgifts.comq\x03Xb\x00\x00\x00htt',
b'I am Bread, 72': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/40B2AC2B9CC73520?redeemer=xvkvctwm%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/868A11AE5F5CAC39?redeemer=dtwggqot%40skinsgifts.comq\x03Xb\x00\x00\x00htt',
b'Forget Me Not: My Organic Garden, 74': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/FDD9F850DDB70369?redeemer=xvkvctwm%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/A310E30EFA33FF40?redeemer=dtwggqot%40skinsgifts.comq\x03Xb\x00\x00\x00htt',
b'Blue Estate The Game, 72': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/4F56053C47479926?redeemer=zpuvbsbi%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/BD574CB54CEFB36A?redeemer=xvkvctwm%40skinsgifts.comq\x03Xb\x00\x00\x00htt',
b'Lex Mortis, 74': b'\x80\x03cbuiltins\nset\nq\x00]q\x01(Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/09CCA4C8D4E57036?redeemer=xvkvctwm%40skinsgifts.comq\x02Xb\x00\x00\x00https://store.steampowered.com/account/ackgift/EA6E67E98ECDE852?redeemer=zpuvbsbi%40skinsgifts.comq\x03Xb\x00\x00\x00htt'}
What I see is that the third element of every value of the database starts with 'htt' and the value itself doesn't have a binary ending.