vdf icon indicating copy to clipboard operation
vdf copied to clipboard

Exception while trying the example on readme

Open ndojibus opened this issue 2 years ago • 0 comments

Hello

I got an exception while trying the example on duplicates. When reassigning a duplicate and after printing the duplicate, get_all_for('key') fails with


>>> d[(1, 'key')] = 123  # reassign specific duplicate
>>> d.get_all_for('key')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python310\lib\site-packages\vdf\vdict.py", line 190, in get_all_for
    return [self[(idx, key)] for idx in _range(self.__kcount[key])]
  File "C:\Program Files\Python310\lib\site-packages\vdf\vdict.py", line 190, in <listcomp>
    return [self[(idx, key)] for idx in _range(self.__kcount[key])]
  File "C:\Program Files\Python310\lib\site-packages\vdf\vdict.py", line 87, in __getitem__
    return super(VDFDict, self).__getitem__(self._normalize_key(key))
KeyError: (2, 'key')

is it a bug or the examples are not up to date?

ndojibus avatar Jan 03 '23 09:01 ndojibus