Skip to content

[MINOR] Fix formatting string in _ODFReader.get_sheet_by_name #28849

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

Closed
wants to merge 1 commit into from

Conversation

zero323
Copy link

@zero323 zero323 commented Oct 8, 2019

This PR fixes minor problem with _ODFReader.get_sheet_by_name method.

If name is not found, it attempts to raise a ValueError with formatted string that expects keyword argument name, however names is passed as a positional argument. In effect it will throw unexpected KeyError.

Steps to reproduce the problem:

from odf.opendocument import OpenDocumentSpreadsheet
import tempfile

path = tempfile.mktemp()
OpenDocumentSpreadsheet().save(path)
pd.read_excel(path, engine="odf", sheet_name="foo")

# Traceback (most recent call last):
...
# KeyError: 'name'

Expected behavior

# Traceback (most recent call last):
# ...
# ValueError: sheet foo not found
  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@jbrockmendel
Copy link
Member

Makes sense. Can you add a test for this

@WillAyd
Copy link
Member

WillAyd commented Oct 8, 2019

This is a dupe of #27677 - @ilogue is that still active?

@zero323
Copy link
Author

zero323 commented Oct 8, 2019

This is a dupe of #27677 - @ilogue is that still active?

My bad, sorry.

@zero323 zero323 closed this Oct 8, 2019
@WillAyd
Copy link
Member

WillAyd commented Oct 8, 2019

No worries! Let’s see if still active if not can certainly reopen this

@JasperVanDenBosch
Copy link
Contributor

@WillAyd yes gtg from my end, waiting for new reviews

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 this pull request may close these issues.

4 participants