| Issue 126: | Header with images + Table of contents produce a rst2pdf crash | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Attached to this bug reports, you will find a valid rst file that produce a
crash of rst2pdf.
Header without contents == No problem
Contents without header == No problem
Header + Contents == Problem :)
My Traceback is :
Traceback (most recent call last):
File "/usr/local/bin/rst2pdf", line 8, in <module>
load_entry_point('rst2pdf==0.10.1', 'console_scripts', 'rst2pdf')()
File
"/usr/local/lib/python2.6/dist-packages/rst2pdf-0.10.1-py2.6.egg/rst2pdf/createpdf.py",
line 1439, in main
compressed=options.compressed)
File
"/usr/local/lib/python2.6/dist-packages/rst2pdf-0.10.1-py2.6.egg/rst2pdf/createpdf.py",
line 1132, in createPdf
pdfdoc.multiBuild(elements)
File
"/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line
855, in multiBuild
self.build(tempStory, filename, canvasmaker)
File
"/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line
777, in build
self.handle_flowable(flowables)
File
"/usr/lib/python2.6/dist-packages/reportlab/platypus/doctemplate.py", line
665, in handle_flowable
if frame.add(f, canv, trySplit=self.allowSplitting):
File "/usr/lib/python2.6/dist-packages/reportlab/platypus/frames.py",
line 159, in _add
w, h = flowable.wrap(aW, h)
File "/usr/lib/python2.6/dist-packages/reportlab/platypus/flowables.py",
line 543, in wrap
W,H = _listWrapOn(self._content,aW,self.canv,dims=dims)
File "/usr/lib/python2.6/dist-packages/reportlab/platypus/flowables.py",
line 468, in _listWrapOn
cframe = doct.frame = deepcopy(doct_frame)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 292, in _deepcopy_inst
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 292, in _deepcopy_inst
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 228, in _deepcopy_list
y.append(deepcopy(a, memo))
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 292, in _deepcopy_inst
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 189, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/usr/lib/python2.6/copy.py", line 338, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 292, in _deepcopy_inst
state = deepcopy(state, memo)
File "/usr/lib/python2.6/copy.py", line 162, in deepcopy
y = copier(x, memo)
File "/usr/lib/python2.6/copy.py", line 255, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib/python2.6/copy.py", line 188, in deepcopy
"un(deep)copyable object of type %s" % cls)
copy.Error: un(deep)copyable object of type <type 'ImagingCore'>
|
|
,
Jun 02, 2009
Congratulations, that is a real bug :-) I'll take a look at it, but it looks hard to fix.
Status: Accepted
|
|
,
Jun 02, 2009
Ok, the problem is that, when you use a TOC, reportlab does a multibuild. When you do a multibuild, reportlab is trying to do a deepcopy of the FancyPage object. When you have an image in the header, FancyPage.head contains a reference to an Image flowable. The image flowable contains a reference to an ImagingCore object.... which is not copiable. Solution: remove the head reference from the FancyPage object (it can just as easily be global, for example). I will try to fix this today, but it's not exactly trivial. |
|
,
Jun 02, 2009
Commited a *very* bad fix in r661. I will keep the issue open because I don't like it at all. |
|
,
Jun 03, 2009
Ok, the elegant fix is way too hard. Closing.
Status: Fixed
|
|
|
|