Tôi đang sử dụng mô-đun giá để lưu một số dữ liệu. Các giá trị của các khóa của đối tượng giá đỡ của tôi là các đối tượng được đặt.giá đỡ làm tăng EOFError sau một vài lần lặp lại/tháo móc
đoạn phẩm làm sạch:
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()
sau một vài bãi trừ EOFError được nâng lên:
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
Dưới đây là những gì tôi có trong cơ sở dữ liệu xiên của tôi trong represantation nhị phân:
{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'}
Điều tôi thấy là phần tử thứ ba của mọi giá trị của cơ sở dữ liệu bắt đầu bằng 'htt' và giá trị chính nó không có kết thúc nhị phân.
Câu hỏi hay. Tốt bằng văn bản và chứa tất cả các thông tin có liên quan để tái sản xuất. Làm cho ngày của tôi. –
Trên thực tế, bạn có thể hiển thị mã để xây dựng và tẩy bộ này không? –
Nó vẫn là một câu hỏi hay. Thông tin còn thiếu không phải là một thiếu sót rõ ràng. Nó chỉ là để đáp ứng sự tò mò của tôi về một điều. –