DOCX Input: Handle DOCX files that are missing a settings.xml file, despite it being listed in the manifest

This commit is contained in:
Kovid Goyal 2015-05-21 10:14:51 +05:30
parent ba2f5db4f0
commit 85bb1dbeec

View File

@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import sys, os, re, math import sys, os, re, math, errno
from collections import OrderedDict, defaultdict from collections import OrderedDict, defaultdict
from lxml import html from lxml import html
@ -282,6 +282,10 @@ class Convert(object):
seraw = self.docx.read(sename) seraw = self.docx.read(sename)
except KeyError: except KeyError:
self.log.warn('Settings %s do not exist' % sename) self.log.warn('Settings %s do not exist' % sename)
except EnvironmentError as e:
if e.errno != errno.ENOENT:
raise
self.log.warn('Settings %s file missing' % sename)
else: else:
self.settings(fromstring(seraw)) self.settings(fromstring(seraw))