diff options
Diffstat (limited to 'epubgrep.py')
-rwxr-xr-x | epubgrep.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/epubgrep.py b/epubgrep.py index 18ab6e4..5fcf2dd 100755 --- a/epubgrep.py +++ b/epubgrep.py @@ -7,6 +7,7 @@ import re import sys import zipfile +from xml.parsers.expat import ExpatError from typing import Any, Dict, List, Optional, Tuple import epub_meta @@ -156,6 +157,9 @@ def grep_book(filename: str, opts: argparse.Namespace, except (epub_meta.EPubException, KeyError, IndexError): log.exception(f'Failed to open {filename}') return None + except ExpatError: + log.warning(f'Cannot open (most likely DRMed) {filename}') + return None book = zipfile.ZipFile(filename) printed_booktitle = False |