question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'module' object has no attribute 'request'

See original GitHub issue

Hello!

After a fresh install I ran the example code from the readme file and it gave me the following error:

>>> from newsplease import NewsPlease
>>> article = NewsPlease.from_url('https://www.nytimes.com/2017/02/23/us/politics/cpac-stephen-bannon-reince-priebus.html?hp')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gregor/anaconda/lib/python2.7/site-packages/newsplease/__init__.py", line 79, in from_url
    articles = NewsPlease.from_urls([url])
  File "/Users/gregor/anaconda/lib/python2.7/site-packages/newsplease/__init__.py", line 98, in from_urls
    html = SimpleCrawler.fetch_url(url)
  File "/Users/gregor/anaconda/lib/python2.7/site-packages/newsplease/crawler/simple_crawler.py", line 16, in fetch_url
    return SimpleCrawler._fetch_url(url, False)
  File "/Users/gregor/anaconda/lib/python2.7/site-packages/newsplease/crawler/simple_crawler.py", line 27, in _fetch_url
    req = urllib.request.Request(url, None, headers)
AttributeError: 'module' object has no attribute 'request'

Python 2.7.13 (on macOS 10.12.5 Sierra) urllib is installed

Unfortunately I had no time for debugging. Might come back to it soon.

Gregor

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gambolputtycommented, Aug 4, 2017

Awesome. Vielen Dank 😃

0reactions
fhamborgcommented, Sep 23, 2017

can you open a new ticket with a detailed bug report for the problem that specifically occurred to you? otherwise, i will not be able to fix the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'module' object has no attribute 'request'
So, the way import in python works is that it first searches the current dir, and if it finds the module/package 'x' u...
Read more >
'module' object has no attribute 'request' - PYTHON - YouTube
PYTHON : AttributeError : ' module' object has no attribute 'request ' [ Gift : Animated Search Engine ...
Read more >
[SOLVED] AttributeError: module 'urllib' has no attribute 'request'
When you try to: import urllib and use: urllib. request... and you see an error: AttributeError : module 'urllib' has no attribute '...
Read more >
attributeerror: module 'urllib.request' has no attribute 'json'
The simple solution is to rename your "email.py" module to something else, or (if it's only a script and not a module) move...
Read more >
Python Error: 'module' object has no attribute 'urlopen'
The “request” module is where many of the web request functions in the “urllib” package are bundled. AttributeErrors are raised when you try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found