Closed GoogleCodeExporter closed 8 years ago
What steps will reproduce the problem? import prettytable pt = prettytable.PrettyTable('a b c'.split()) pt.add_row([1,2,3]) pt.add_row([4,5,6]) pt.printt() # Works as expected # Now let's change the headers... pt.field_names = "aaa bbb ccc".split() pt.printt() # oops! # This gets printed: +---+---+---+ | aaa | bbb | ccc | +---+---+---+ | 1 | 2 | 3 | | 4 | 5 | 6 | +---+---+---+ # Setting the headers a second time fixes this issue: pt.field_names = "aaa bbb ccc".split() pt.printt() +-----+-----+-----+ | aaa | bbb | ccc | +-----+-----+-----+ | 1 | 2 | 3 | | 4 | 5 | 6 | +-----+-----+-----+ I believe this happens because self._recompute_widths() is called before setting the new value for _field_names. Tested with: * prettytable SVN revision 36 * Python 2.6
Original issue reported on code.google.com by denilsonsa on 17 Jan 2011 at 5:51
denilsonsa
Fixed in trunk. Thank you for reporting and sorry for the delay!
Original comment by luke@maurits.id.au on 9 Jul 2011 at 7:50
luke@maurits.id.au
Original issue reported on code.google.com by
denilsonsa
on 17 Jan 2011 at 5:51