AttributeError: 'module' object has no attribute 'request'
See original GitHub issueHello!
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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome. Vielen Dank 😃
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.