gillesB
gillesB

Reputation: 1179

Error on initalization of PyLatex Table

My goal is to create a floating table with PyLatex, to do this I want to use the class Table. But when I initialize a Table I get the following error:

Traceback (most recent call last):
  File "table.py", line 18, in <module>
    table = Table('rc|cl')
TypeError: __init__() takes exactly 1 argument (2 given)

This is really confusing as I consider 'rc|cl' as 1 argument. To make sure I make nothing wrong I executed a script from Nullege, which results in the error above.

Upvotes: 0

Views: 240

Answers (1)

gillesB
gillesB

Reputation: 1179

As Feodoran mentioned in his comment the Tabular must be wrapped inside a Table to make it float.

doc = Document()

with doc.create(Table()):
   with doc.create(Tabular("llr")) as tabular:
      tabular.add_row(("Foo", "Bar", "Foobar"))
      tabular.add_hline()
      # etc

Upvotes: 1

Related Questions