The "if not line[i]" check would cause an IndexError earlier than the
exception. Also, report the line number where that happened.
(the +2 op. is needed because we skip 1 for header and count at 0)
(cherry picked from commit
7f7e84e32405d4552b8f1b156d359d629bbca353)
bzr revid: p_christ@hol.gr-
20110420152413-knedwepb0tmersw4
done = {}
for i in range(len(fields)):
res = False
+ if i >= len(line):
+ raise Exception(_('Please check that all your lines have %d columns.'
+ 'Stopped around line %d having %d columns.') % \
+ (len(fields), position+2, len(line)))
if not line[i]:
continue
- if i >= len(line):
- raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),))
field = fields[i]
if field[:len(prefix)] <> prefix: