[reportlab-users] Re: Font Naming Problems
Robin Becker
robin at reportlab.com
Wed Jul 13 05:06:23 EDT 2005
Timothy Smith wrote:
> i have a situation where i'm using a list of lists for a data in a
> table, then deleteing some elements from it and reusing it, and i'm
> getting this error. i'm double triple checked all the rows in it are the
> same lenght, so i'm a bit stumped as to what this error means.
>
> File
> "/usr/local/lib/python2.3/site-packages/reportlab/platypus/tables.py",
> line 419, in _hasVariWidthElements
> value = self._cellvalues[row][col]
> IndexError: list index out of range
>
..... you're probably hitting a mutable re-use problem. The lists are not copied
into the table internally. Deleting a row/column in one usage will affect all so
unless you are careful the error is fairly easily created.
For example
>>> A=[[1,2,3],[4,5,6]]
>>> B = A
>>> del B[0][-1], B[1][-1]
>>> A
[[1, 2], [4, 5]]
>>>
--
Robin Becker
More information about the reportlab-users
mailing list