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

AttributeError: 'module' object has no attribute 'build' #59

Closed
theshapguy opened this issue Jul 7, 2014 · 1 comment
Closed

AttributeError: 'module' object has no attribute 'build' #59

theshapguy opened this issue Jul 7, 2014 · 1 comment

Comments

@theshapguy
Copy link

import newspaper
cnn_paper = newspaper.build('http://cnn.com', memoize_articles=False)

for article in cnn_paper.articles:
    print article.url

The code above works sometime and other times it doesn't. I'm working on a virtualenv however all the required libraries are also installed in the system.

Traceback (most recent call last):
  File "/Users/Shapath/Developer/Python/Newspaper/Newspaper/Parser/newspaperparser.py", line 1, in <module>
    import newspaper
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/newspaper/__init__.py", line 10, in <module>
    from .article import Article, ArticleException
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/newspaper/article.py", line 16, in <module>
    from . import images
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/newspaper/images.py", line 20, in <module>
    from . import urls
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/newspaper/urls.py", line 17, in <module>
    from .packages.tldextract import tldextract
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/newspaper/packages/tldextract/__init__.py", line 1, in <module>
    from .tldextract import extract, TLDExtract
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/newspaper/packages/tldextract/tldextract.py", line 37, in <module>
    import pkg_resources
  File "/Users/Shapath/Developer/Python/Newspaper/lib/python2.7/site-packages/pkg_resources.py", line 76, in <module>
    import parser
  File "/Users/Shapath/Developer/Python/Newspaper/Newspaper/Parser/parser.py", line 4, in <module>
    cnn_paper = newspaper.build('http://cnn.com')
@theshapguy
Copy link
Author

Do not ever name your file name, that can relate to the modules that newspaper is using.

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

1 participant