Problems with HTMLgen tables

Shae Erisson shapr at uab.edu
Wed May 3 17:52:49 EDT 2000


"Martin Skøtt" wrote:
> 
> Hi
> I'am trying to create an HTML table from a Python script using the
> HTMLgen module. In the following lines you can see my test program,
> the file i read, and the Python output when running it. Can you help
> me solve the problem? (Red Hat 5.2, Python 1.5.1)

> table.body = []
> doc.append(table)
> for line in fila:
>     inf = string.strip(line)
>     table.body.append(inf)

I get the same error on Debian 2.1, Python 1.5.2
As best as I can tell, making an empty body and then appending to it is
something HTMLgen doesn't like. I looked at the documentation for
HTMLgen, and it seems the preferred method is to make your list first,
and then set it to table.body
I got the above to work with this change:

table = HTMLgen.Table()
bodybitz = []
for line in fila:
    bitz = string.split(line,' ')
    bodybitz.append(bitz)
table.body = bodybitz

It's just a workaround, but I hope it helps.
-- 
sHae mAtijs eRisson (sHae at wEbwitchEs.coM) gEnius fOr hIre
   bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt
and my cat started dancing around singing "I'm nacked, I'm nacked!"



More information about the Python-list mailing list