reposting - AttributeError: type object 'HTMLAwareEntitySubstitution' has no attribute 'preserve_whitespace_tags'

40 views
Skip to first unread message

randytho...@u.northwestern.edu

unread,
Nov 28, 2016, 10:31:27 PM11/28/16
to beautifulsoup
I am posting this again as I did not get any replies to my first posting.  I can get this to work with Enthough Canopy but not with Anaconda in a Jupyter Notebook?  Any thoughts on why it works in Canopy but not with Anaconda?

I am just trying this for the first time.  I installed BeautifulSoup and html5lib.  When I try this command:  from bs4 import BeautifulSoup, I get the following error message: 




---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-519-9144e80cd349> in <module>()
----> 1 from bs4 import BeautifulSoup

C:\Users\thompr1\AppData\Local\Continuum\Anaconda3\lib\site-packages\bs4\__init__.py in <module>()
     33 import warnings
     34 
---> 35 from .builder import builder_registry, ParserRejectedMarkup
     36 from .dammit import UnicodeDammit
     37 from .element import (

C:\Users\thompr1\AppData\Local\Continuum\Anaconda3\lib\site-packages\bs4\builder\__init__.py in <module>()
    226 
    227 
--> 228 class HTMLTreeBuilder(TreeBuilder):
    229     """This TreeBuilder knows facts about HTML.
    230 

C:\Users\thompr1\AppData\Local\Continuum\Anaconda3\lib\site-packages\bs4\builder\__init__.py in HTMLTreeBuilder()
    232     """
    233 
--> 234     preserve_whitespace_tags = HTMLAwareEntitySubstitution.preserve_whitespace_tags
    235     empty_element_tags = set(['br' , 'hr', 'input', 'img', 'meta',
    236                               'spacer', 'link', 'frame', 'base'])

AttributeError: type object 'HTMLAwareEntitySubstitution' has no attribute 'preserve_whitespace_tags'


I found one posting on reddit that said when they installed html5lib, their issue resolved, but mine has not.

Any thoughts?

I am using Python 3.5, Jupyter Notebook IPython version 4.2.0, windows 10

Thank you.
Reply all
Reply to author
Forward
0 new messages