Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key error 29 #80

Open
rubinglen opened this issue Mar 20, 2024 · 4 comments
Open

Key error 29 #80

rubinglen opened this issue Mar 20, 2024 · 4 comments

Comments

@rubinglen
Copy link

Strange error I'm getting when I try to run numbers_parser on certain files, it yields a stack with key error 29, other Numbers files it seems to work fine on. Any advice?

Traceback (most recent call last):
File "/Users/glucosamigos/py_scripts/ocr_goo.py", line 197, in
numdoc = Document("/Users/glucosamigos/py_scripts/newsheet.numbers")
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/document.py", line 90, in init
self._sheets = ItemsList(self._model, refs, Sheet)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/containers.py", line 11, in init
self._items = [item_class(model, _) for _ in refs]
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/document.py", line 324, in init
self._tables = ItemsList(self._model, refs, Table)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/containers.py", line 11, in init
self._items = [item_class(model, _) for _ in refs]
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/document.py", line 431, in init
cell_storage = model.table_cell_decode(table_id, row, col)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/numbers_cache.py", line 25, in inner_multi_args
value = func(self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/model.py", line 1760, in table_cell_decode
return CellStorage(self, table_id, buffer, row, col)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/cell_storage.py", line 196, in init
self.value = self.model.table_string(table_id, self.string_id)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/numbers_cache.py", line 25, in inner_multi_args
value = func(self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/model.py", line 491, in table_string
return self._table_strings.lookup_value(table_id, key).string
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/numbers_parser/model.py", line 169, in lookup_value
return self._datalists[table_id]["by_key"][key]
KeyError: 29

@masaccio
Copy link
Owner

The line that refers to CellStorage suggests you have a slightly older version of numbers-parser (I changed this last week). The error itself is numbers-parser not finding a string in the string table. If the new version doesn’t work you would need to share a broken file with me.

The best approach to reduce confidential data to a test case is to progressively delete half the data and rechecking. If the file loads after deleting half, undo and delete the other half. I’ve found this bisecting technique gets me a minimal example pretty quickly.

@darioclock
Copy link

I get the same error when I try to open a corrupted file on issue #79

@rubinglen
Copy link
Author

rubinglen commented Mar 21, 2024 via email

@masaccio
Copy link
Owner

v4.10.4 contains some fixes to datalists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants