From 05b97d86e0451e4453edae6511b0d9bced4a6a8e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 25 Jan 2017 08:48:48 +0530 Subject: [PATCH] DOCX Input: Fix error when converting documents that have images pointing to web resources. Fixes #1659142 [DocX to ePub conversion fault (Error Code: 1)](https://bugs.launchpad.net/calibre/+bug/1659142) --- src/calibre/ebooks/docx/images.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/docx/images.py b/src/calibre/ebooks/docx/images.py index 0a4273b7cf..8908a218bb 100644 --- a/src/calibre/ebooks/docx/images.py +++ b/src/calibre/ebooks/docx/images.py @@ -134,7 +134,10 @@ class Images(object): with open(src, 'rb') as rawsrc: raw = rawsrc.read() else: - raw = self.docx.read(fname) + try: + raw = self.docx.read(fname) + except KeyError: + raise LinkedImageNotFound(fname) base = base or image_filename(fname.rpartition('/')[-1]) or 'image' ext = what(None, raw) or base.rpartition('.')[-1] or 'jpeg' if ext == 'emf':