Skip to content

AttributeError: 'str' object has no attribute 'text' #1

@talhasch

Description

@talhasch

BeautifulSoup constructor "lxml" parameter on line 209 causes AttributeError if beautifulsoup4 not installed.

Traceback (most recent call last): File "__init__.py", line 229, in <module> d = extractArticlePublishedDate("https://www.youtube.com/watch?v=_OBlgSz8sSM") File "__init__.py", line 209, in extractArticlePublishedDate parsedHTML = BeautifulSoup(html, "lxml") File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1522, in __init__ BeautifulStoneSoup.__init__(self, *args, **kwargs) File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1147, in __init__ self._feed(isHTML=isHTML) File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1189, in _feed SGMLParser.feed(self, markup) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sgmllib.py", line 104, in feed self.goahead(0) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sgmllib.py", line 174, in goahead k = self.parse_declaration(i) File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1463, in parse_declaration j = SGMLParser.parse_declaration(self, i) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/markupbase.py", line 109, in parse_declaration self.handle_decl(data) File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1448, in handle_decl self._toStringSubclass(data, Declaration) File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1381, in _toStringSubclass self.endData(subclass) File "/Library/Python/2.7/site-packages/BeautifulSoup.py", line 1251, in endData (not self.parseOnlyThese.text or \ AttributeError: 'str' object has no attribute 'text'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions