[reportlab-users] can't get table of tables

Jean-Yves F. Barbier 12ukwn at gmail.com
Wed Feb 1 06:09:43 EST 2012


Hi list,

I spent several hours on a PB that may be trivial, but I don't see
where I'm wrong.

I've got several 1 line tables, such as:

R8, dum, crt, crn, crv, ntpt, ntpc, ntpv = None, None, None, None, None, None, None, None
recapR8 = []
# Nothing
dum = Paragraph(u"</br>&nbsp;", docRecapTitles)
#
if self.docSummary.hdr1 != u"ESLM":
crt = Paragraph(_(u"ESLM"), docRecapHeaders)
crn = Paragraph(self.docSummary.hdr1_type, docRecapTitles)
crv = Paragraph(unicode('{:6,.9f}'.format(self.docSummary.hdr1_st)), docRecapNumbers)
else:
crt = Paragraph(u"</br>&nbsp;", docRecapNumbers)
crn, crv = crt, crt
#
ntpt = Paragraph(_(u"Grand Total"), docRecapHeaders)
ntpc = Paragraph(self.docSummary.hdrs_mtype, docRecapTitles)
ntpv = Paragraph(unicode('{:12,.2f}'.format(self.docSummary.grans_total)), docRecapNumbers)
recapR8.append( [ dum, crt, crn, crv, ntpt, ntpc, ntpv ] )
R8 = Table( recapR8, 1*[ 1.5*cm,
1.7*cm, 0.6*cm, 2.7*cm,
4.6*cm, 0.6*cm, 2.0*cm ], 1*[ 3.5*mm ] )
# Update recap list
data.append( R8 )

But I don't succeed printing the result as a whole:

rt = Table( data, 9*[ 19.50*cm ], 9*[ 3.5mm ] )

Traceback (most recent call last):
File "create_doc_pdf__2012-02-01_01.py", line 2649, in <module>
ERPpdf( dbUserId, docType, docCliSup, docId, cursor=u"None" )
File "create_doc_pdf__2012-02-01_01.py", line 411, in __init__
self.docRecap()
File "create_doc_pdf__2012-02-01_01.py", line 1769, in docRecap
rt = Table( data, 9*[ 19.5*cm ], 9*[ 3.5*mm ] )
File "/usr/lib/python2.7/dist-packages/reportlab/platypus/tables.py", line 259, in __init__
self._cellvalues = data = self.normalizeData(data)
File "/usr/lib/python2.7/dist-packages/reportlab/platypus/tables.py", line 330, in normalizeData
outRow = [normCell(cell) for cell in row]
TypeError: iteration over non-sequence

Where am I wrong?

JY
--
The secret of healthy hitchhiking is to eat junk food.


More information about the reportlab-users mailing list