astanin / python-tabulate

Pretty-print tabular data in Python, a library and a command-line utility. Repository migrated from bitbucket.org/astanin/python-tabulate.
https://pypi.org/project/tabulate/
MIT License
2.1k stars 163 forks source link

SEPARATING_LINE does not work with dataclasses #267

Open baolsen opened 1 year ago

baolsen commented 1 year ago

Using tabulate to print a list of dataclasses when one or more rows is SEPARATING_LINE, produces:

  File "....\.venv\lib\site-packages\tabulate\__init__.py", line 1451, in <listcomp>
    rows = [[getattr(row, f) for f in field_names] for row in rows ]
AttributeError: 'str' object has no attribute '<the first attribute of dataclass>'

Can be assigned to me, I have a fix.