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

Some spreadsheets fail with latest openpyxl #466

Open
Bjwebb opened this issue Oct 23, 2024 · 0 comments
Open

Some spreadsheets fail with latest openpyxl #466

Bjwebb opened this issue Oct 23, 2024 · 0 comments

Comments

@Bjwebb
Copy link
Member

Bjwebb commented Oct 23, 2024

3.1.2 is the last version that works as expected, all versions since then fail.

Traceback from IATI CoVE:

ERROR 2024-10-23 10:37:29,095 exceptions 14933 140580921275968 Nested.from_tree() missing 1 required positional argument: 'node'
Traceback (most recent call last):
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/libcove/lib/exceptions.py", line 28, in wrapper
    return func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/libcove/lib/converters.py", line 126, in convert_spreadsheet
    flattentool.unflatten(input_name, **flattentool_options)
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/flattentool/__init__.py", line 291, in unflatten
    spreadsheet_input.read_sheets()
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/flattentool/input.py", line 717, in read_sheets
    self.workbook = openpyxl.load_workbook(self.input_name, data_only=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/reader/excel.py", line 348, in load_workbook
    reader.read()
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/reader/excel.py", line 303, in read
    self.read_worksheets()
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/reader/excel.py", line 274, in read_worksheets
    pivot_caches = self.parser.pivot_caches
                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/reader/workbook.py", line 128, in pivot_caches
    cache = get_rel(self.archive, self.rels, id=c.id, cls=CacheDefinition)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/packaging/relationship.py", line 150, in get_rel
    obj = cls.from_tree(tree)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/serialisable.py", line 83, in from_tree
    obj = desc.from_tree(el)
          ^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/sequence.py", line 94, in from_tree
    return [self.expected_type.from_tree(el) for el in node]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/sequence.py", line 94, in <listcomp>
    return [self.expected_type.from_tree(el) for el in node]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/serialisable.py", line 87, in from_tree
    obj = desc.expected_type.from_tree(el)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/serialisable.py", line 83, in from_tree
    obj = desc.from_tree(el)
          ^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/sequence.py", line 94, in from_tree
    return [self.expected_type.from_tree(el) for el in node]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/cove/.ve/lib/python3.11/site-packages/openpyxl/descriptors/sequence.py", line 94, in <listcomp>
    return [self.expected_type.from_tree(el) for el in node]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Nested.from_tree() missing 1 required positional argument: 'node'

Those with the appropriate permissions can find the failing spreadsheets at: https://iati.zendesk.com/agent/tickets/45342

I will try to reproduce and report this upstream.

Bjwebb added a commit to OpenDataServices/cove that referenced this issue Oct 24, 2024
This avoids particular spreadsheets breaking:
OpenDataServices/flatten-tool#466
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

1 participant