Knio / dominate

Dominate is a Python library for creating and manipulating HTML documents using an elegant DOM API. It allows you to write HTML pages in pure Python very concisely, which eliminate the need to learn another template language, and to take advantage of the more powerful features of Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

example in package readme fails with traceback

paregorios opened this issue · comments

I tried the following (from the dominate package README) with Python 3.7.3 and dominate==2.3.5 in a virtual environment under OSX Mojave:

    _html = html()
    _head, _body = _html.add(head(title('Whatever')), body())
    print(_html)
    names = ['header', 'content', 'footer']
    header, content, footer = _body.add(div(id=name) for name in names)
    print(_html)

and got the following output:

<html>
  <head>
    <title>Whatever</title>
  </head>
  <body></body>
</html>
Traceback (most recent call last):
  File "scripts/alt_index.py", line 54, in <module>
    OPTIONAL_ARGUMENTS, POSITIONAL_ARGUMENTS, DEFAULT_LOG_LEVEL))
  File "scripts/alt_index.py", line 44, in main
    header, content, footer = _body.add(div(id=name) for name in names)
ValueError: not enough values to unpack (expected 3, got 0)

Fixed. This was due to returning an exhausted generator