Skip to content
This repository has been archived by the owner on Jan 12, 2018. It is now read-only.

Throw an exception if the docx file is invalid. #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JordanReiter
Copy link

Right now if the file is a doc file (i.e. not a zip file) it throws a zipfile.BadZipFile exception, and if it's a zip file missing the right xml files it throws a KeyError. This catches both exceptions and throws a more useful exception that can be caught by a function/tool using python-docx.

Right now if the file is a doc file (i.e. not a zip file) it throws a zipfile.BadZipFile exception, and if it's a zip file missing the right xml files it throws a KeyError. This catches both exceptions and throws a more useful exception that can be caught by a function/tool using python-docx.
@scanny
Copy link
Collaborator

scanny commented Feb 27, 2014

Thanks for this Jordan. I'll get it into the build next time we do a point release.

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

Successfully merging this pull request may close these issues.

2 participants