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

Support corrupted workbooks in xlrd #571

Closed
arturponinski opened this issue Oct 14, 2021 · 0 comments · Fixed by #572
Closed

Support corrupted workbooks in xlrd #571

arturponinski opened this issue Oct 14, 2021 · 0 comments · Fixed by #572

Comments

@arturponinski
Copy link
Collaborator

Minimal, reproducible code sample, a copy-pastable example if possible

petl/test/io/test_xls.py

    def test_passing_kwargs_to_xlutils_view():
        filename = _get_test_xls()
        if filename is None:
            return

        from petl.io.xlutils_view import View
        org_init = View.__init__

        def wrapper(self, *args, **kwargs):
            assert "ignore_workbook_corruption" in kwargs
            return org_init(self, *args, **kwargs)

        with patch("petl.io.xlutils_view.View.__init__", wrapper):
            tbl = fromxls(filename, 'Sheet1', use_view=True, ignore_workbook_corruption=True)
            expect = (('foo', 'bar'),
                      ('A', 1),
                      ('B', 2),
                      ('C', 2),
                      (u'é', datetime(2012, 1, 1)))
            ieq(expect, tbl)
            ieq(expect, tbl)
assert "ignore_workbook_corruption" in kwargs
AssertionError

Problem description

Some xls generators of other vendors output xls workbooks marked as corrupt. In order to support such files, update of xlrd package to 2.0.1 is required, additionally fromxls with use_view=True does not pass kwargs to xlutils_view.View

Version and installation information

Value of petl.version 1.7.5.dev6+dirty
Version of Python interpreter, tests on all supported versions

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

Successfully merging a pull request may close this issue.

1 participant