Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTMLParseError #165

Closed
theshapguy opened this issue Sep 21, 2015 · 3 comments
Closed

HTMLParseError #165

theshapguy opened this issue Sep 21, 2015 · 3 comments

Comments

@theshapguy
Copy link

Getting this error while running Python3 with newspaper in VirtualEnv. However if I run this in Python2 Virtualenv it works seamlessly.

Running OS X 10.10

The Script

import newspaper
paper = newspaper.build('http://androidweekly.net/issues/issue-171', memoize_articles=False)


for i in paper.articles:
    print(i)

The exception

Traceback (most recent call last):
  File "rx.py", line 1, in <module>
    import newspaper
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/newspaper/__init__.py", line 10, in <module>
    from .article import Article, ArticleException
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/newspaper/article.py", line 13, in <module>
    from . import network
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/newspaper/network.py", line 14, in <module>
    from .configuration import Configuration
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/newspaper/configuration.py", line 15, in <module>
    from .parsers import Parser
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/newspaper/parsers.py", line 16, in <module>
    from bs4 import UnicodeDammit
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/bs4/__init__.py", line 30, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/bs4/builder/__init__.py", line 308, in <module>
    from . import _htmlparser
  File "/Users/shapathneupane/Desktop/saito/lib/python3.5/site-packages/bs4/builder/_htmlparser.py", line 7, in <module>
    from html.parser import (
ImportError: cannot import name 'HTMLParseError'
@muranava
Copy link

muranava commented Oct 8, 2015

i followed this and updated beautiful soup http://stackoverflow.com/questions/28745153/importing-bs4-in-python-3-5

@AlJohri
Copy link
Contributor

AlJohri commented Nov 26, 2015

yup, as @muranava said, just upgrade bs4
here's a PR: #171

@codelucas
Copy link
Owner

Thanks for the fix guys! It's been merged and should reflect in pip soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants