Skip to content

TypeError in getHtml #17

Description

@JiriKalvoda

Hi!

Nice library.

I have only one small problem. When i try print tag which contain attribute with None value, print fail.

Here is simple code to reproduce that:

import AdvancedHTMLParser

parser = AdvancedHTMLParser.AdvancedHTMLParser()
parser.parseStr('<div itemscope itemtype="http://schema.org/Order">')
parser.getHTML()

Returnung:

Traceback (most recent call last):
  File "/home/jiri/userconfig/mail/error.py", line 5, in <module>
    parser.getHTML()
  File "/tmp/p/venv/lib/python3.11/site-packages/AdvancedHTMLParser/Parser.py", line 887, in getHTML
    return doctypeStr + rootNode.outerHTML
           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

Observed on python 3.11.5 (Arch linux) with up-to-date package from pip.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions