Невозможно открыть сохраненный список в файле shelve.open ("mydata1 ') - PullRequest
0 голосов
/ 07 мая 2020
import shelve
shelffile = shelve.open('mydata1')
shelffile['cat'] = ["Zhophie", "Sweety"]
shelffile.close()
shelffile = shelve.open("mydata.dat")
shelffile["cat"]
Traceback (most recent call last):
  File "C:\Python3\lib\shelve.py", line 111, in __getitem__
    value = self.cache[key]
KeyError: 'cat'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Python3\lib\shelve.py", line 113, in __getitem__
    f = BytesIO(self.dict[key.encode(self.keyencoding)])
  File "C:\Python3\lib\dbm\dumb.py", line 147, in __getitem__
    pos, siz = self._index[key]     # may raise KeyError
KeyError: b'cat'
shelffile = shelve.open('mydata')
shelffile['cat']

Я открыл pycharm в режиме администратора, поэтому у него есть все разрешения. keyError: что означает кошка?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...