mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #746043 (Conversion from specific LRF books gives "RuntimeError: maximum recursion depth exceeded")
This commit is contained in:
parent
df6fabfff4
commit
7095e33100
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import os, textwrap
|
import os, textwrap, sys
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
@ -413,7 +413,12 @@ class LRFInput(InputFormatPlugin):
|
|||||||
('calibre', 'image-block'): image_block,
|
('calibre', 'image-block'): image_block,
|
||||||
}
|
}
|
||||||
transform = etree.XSLT(styledoc, extensions=extensions)
|
transform = etree.XSLT(styledoc, extensions=extensions)
|
||||||
|
try:
|
||||||
result = transform(doc)
|
result = transform(doc)
|
||||||
|
except RuntimeError:
|
||||||
|
sys.setrecursionlimit(5000)
|
||||||
|
result = transform(doc)
|
||||||
|
|
||||||
with open('content.opf', 'wb') as f:
|
with open('content.opf', 'wb') as f:
|
||||||
f.write(result)
|
f.write(result)
|
||||||
styles.write()
|
styles.write()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user