Skip to content

Check for openpyxl #1007

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 4 commits into from
Closed

Conversation

michaelaye
Copy link
Contributor

I added a try/except catch for the lack of an installed openpyxl. The user gets a nice message that she needs to install it or to save the .xlsx file as .xls.
I also added a test for it and a test.xlsx file that I saved from test.xls.
Furthermore I noticed an ugly break of the DRY principle in ExcelFile.parse and gave an alternative with a nice dictionary that provides the handle for the required method depending on the 'use_xlsx' flag.

…e saved from test.xls. Beautified ugly break of DRY principle in ExcelFile.parse
"You can install it via 'easy_install openpyxl' or 'pip openpyxl'.\n"
"Alternatively, you could save the .xlsx file as a .xls file.\n"
"Parsed nothing for now.\n")
return
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure how to get out of the Exception Handling? Let me know if you desire something else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think returning None is appropriate in this case; an exception should be raised (with the more helpful error message)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, fixed that. How cool that github automatically adds that commit to this pull request! I guess pull requests are related to the branch, so when I change the branch it will be included in the pull request? (I am still new to githubbing.. ;)

@wesm wesm closed this Apr 10, 2012
@wesm
Copy link
Member

wesm commented Apr 10, 2012

thanks a lot

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.

3 participants