Closed push44 closed 1 year ago
That's a lookup error resulting from a specific string in a file. Since I don't have your test file, this is impossible to reproduce.
@push44 you'll need to attach a file to demonstrate the issue.
Sorry without a reproducer for this I will not be able to resolve your issue.
Above code throws following error
`File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/document.py:30, in Document.init(self, filename) 28 self._model = _NumbersModel(filename) 29 refs = self._model.sheet_ids() ---> 30 self._sheets = ItemsList(self._model, refs, Sheet)
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/containers.py:12, in ItemsList.init(self, model, refs, item_class) 10 def init(self, model, refs, item_class): 11 self._item_name = item_class.name.lower() ---> 12 self._items = [itemclass(model, ) for _ in refs]
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/containers.py:12, in(.0)
10 def init(self, model, refs, item_class):
11 self._item_name = item_class.name.lower()
---> 12 self._items = [itemclass(model, ) for _ in refs]
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/document.py:84, in Sheet.init(self, model, sheet_id) 82 self._model = model 83 refs = self._model.table_ids(self._sheet_id) ---> 84 self._tables = ItemsList(self._model, refs, Table)
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/containers.py:12, in ItemsList.init(self, model, refs, item_class) 10 def init(self, model, refs, item_class): 11 self._item_name = item_class.name.lower() ---> 12 self._items = [itemclass(model, ) for _ in refs]
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/containers.py:12, in(.0)
10 def init(self, model, refs, item_class):
11 self._item_name = item_class.name.lower()
---> 12 self._items = [itemclass(model, ) for _ in refs]
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/document.py:144, in Table.init(self, model, table_id) 142 self._data.append([]) 143 for col_num in range(self.num_cols): --> 144 cell_storage = model.table_cell_decode(table_id, row_num, col_num) 145 if cell_storage is None: 146 cell = Cell.empty_cell(table_id, row_num, col_num, model)
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/model.py:1143, in _NumbersModel.table_cell_decode(self, table_id, row_num, col_num) 1140 if buffer is None: 1141 return None -> 1143 cell = CellStorage(self, table_id, buffer, row_num, col_num) 1144 return cell
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/cell_storage.py:165, in CellStorage.init(self, model, table_id, buffer, row_num, col_num) 163 self.type = CellType.NUMBER 164 elif cell_type == TSTArchives.textCellType: --> 165 self.value = self.model.table_string(table_id, self.string_id) 166 self.type = CellType.TEXT 167 elif cell_type == TSTArchives.dateCellType:
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/model.py:261, in _NumbersModel.table_string(self, table_id, key) 259 """Return the string assocuated with a string ID for a particular table""" 260 self._table_strings.add_table(table_id) --> 261 return self._table_strings.lookup_value(table_id, key).string
File ~/Documents/Local/Local/lib/python3.9/site-packages/numbers_parser/model.py:84, in DataLists.lookup_value(self, table_id, key) 82 def lookup_value(self, table_id: int, key: int): 83 """Return the an entry in a table's datalist matching a key""" ---> 84 return self._datalists[table_id]["by_key"][key]
KeyError: 18`