[reportlab-users] platypus/tables.py: TypeError: 'NoneType' object is unsubscriptable

Gotsyk gotsyk at gmail.com
Mon Jun 2 16:50:36 EDT 2008


Hi,

I am using Platypus (RL Toolkit 2.0, SVN Rev. 3046) to compose a
document that has a table in it.

I've got such error:
File "<work folder>/GeneratePDF.py", line 133, in build_doc
self.doc.build(self.story, onFirstPage=self.footer_off,
onLaterPages=self.footer_on)
File
"/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py",
line 911, in build
BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
File
"/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py",
line 740, in build
self.handle_flowable(flowables)
File
"/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py",
line 657, in handle_flowable
if frame.add(S[0], self.canv, trySplit=0):
File "/usr/lib/python2.5/site-packages/reportlab/platypus/frames.py",
line 141, in _add
w, h = flowable.wrap(aW, h)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py",
line 978, in wrap
self._calc(availWidth, availHeight)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py",
line 523, in _calc
self._calc_height(availHeight,availWidth,W=W)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py",
line 479, in _calc_height
w = max(colpositions[t[2]+1]-colpositions[t[0]],w)
TypeError: 'NoneType' object is unsubscriptable

I've found, that in this case, in the line w =
max(colpositions[t[2]+1]-colpositions[t[0]],w) of the tables.py t which
was set t = spanRanges[ji] is None. I've found simple workaround to put
this line into try/except:pass and got correct pdf as result.

Can you point me if I am incorrect with my data?

I've found similar letter about year ago in this list but there is no
result there. If that case was resolved, could you point me to it?

Thank you very much.






More information about the reportlab-users mailing list