Fix #3172 (Viewer crashes when opening LIT book)

This commit is contained in:
Kovid Goyal 2009-10-29 13:58:24 -06:00
parent 1ec6a278e7
commit cdadad159f
2 changed files with 2 additions and 7 deletions

View File

@ -174,13 +174,6 @@ def main(args=sys.argv):
elif opts.command: elif opts.command:
sys.argv = args[:1] sys.argv = args[:1]
exec opts.command exec opts.command
elif opts.exec_file:
sys.argv = args
base = os.path.dirname(os.path.abspath(opts.exec_file))
sys.path.insert(0, base)
g = globals()
g['__name__'] = '__main__'
execfile(opts.exec_file, g)
elif opts.debug_device_driver: elif opts.debug_device_driver:
debug_device_driver() debug_device_driver()
elif opts.migrate: elif opts.migrate:

View File

@ -114,6 +114,8 @@ class OEBReader(object):
except etree.XMLSyntaxError: except etree.XMLSyntaxError:
data = re.sub(r'(?is)<tours>.+</tours>', '', data) data = re.sub(r'(?is)<tours>.+</tours>', '', data)
self.logger.warn('OPF contains invalid tours section') self.logger.warn('OPF contains invalid tours section')
data = data.replace('<dc-metadata>',
'<dc-metadata xmlns:dc="http://purl.org/metadata/dublin_core">')
opf = etree.fromstring(data) opf = etree.fromstring(data)
ns = namespace(opf.tag) ns = namespace(opf.tag)