CSV Table Bug

27 views
Skip to first unread message

mdepot

unread,
Nov 3, 2009, 6:32:41 PM11/3/09
to asciidoc, mde...@comcast.net
I think I found a minor bug in version 8.5.1. When I tried to use a
csv table, I got an index out of range error. I'll post it here for
people searching on it:

asciidoc: FAILED: asciidoc.txt: line 74: unexpected error:
asciidoc: ------------------------------------------------------------
Traceback (most recent call last):
File "asciidoc.py", line 5207, in asciidoc
document.translate()
File "asciidoc.py", line 1351, in translate
Section.translate()
File "asciidoc.py", line 1960, in translate
Section.translate_body()
File "asciidoc.py", line 1969, in translate_body
next.translate()
File "asciidoc.py", line 3229, in translate
headrows = self.subs_rows(self.rows[0:1],'header')
File "asciidoc.py", line 3047, in subs_rows
result += self.subs_row(row,rowtype)
File "asciidoc.py", line 3062, in subs_row
col = self.columns[i]
IndexError: list index out of range
asciidoc: ------------------------------------------------------------

It turns out the problem was caused by line 3202:
cols = text[0].count(self.parameters.separator)

This counts the separators *between* the columns. In my case I had 5
columns with of course 4 separators between them. So cols was
erroneously assigned a number one less than it should be.

I changed my copy to
cols = text[0].count(self.parameters.separator) + 1
and all was well ( although I didn't do any bounds testing before
posting this...)

Stuart Rackham

unread,
Nov 4, 2009, 12:51:40 AM11/4/09
to asci...@googlegroups.com
It's a bug! Introduced a long time ago, you only get it if you don't set the
'cols' attribute explicitly.

I've posted the fix to the trunk:

http://hg.sharesource.org/asciidoc/rev/745cccfeb035

Thanks for the bug report.


Cheers, Stuart
> --
>
> You received this message because you are subscribed to the Google Groups "asciidoc" group.
> To post to this group, send email to asci...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/asciidoc?hl=en.
>
>
>

Reply all
Reply to author
Forward
0 new messages