Import requests module failing!!

+1 andrew wigginw · March 5, 2015
Hey guys so I'm pretty new to coding and python coding in general and I have ran into issues with his Python tutorials. Specifically the webcrawler tut and word counter tut.


import requests
from bs4 import BeautifulSoup
import operator

def start(url):
word_list = []
source_code = requests.get(url).text
soup = BeautifulSoup(source_code)
for post_text in soup.findAll('a', {'class': 'title may-blank srTagged imgScanned'}):
content = post_text.string
words = content.lower.split()
for each_word in words:
print(each_word)
word_list.append(each_word)

Error:

         Traceback (most recent call last):
         File "C:/Users/Andrew/PycharmProjects/untitled/chapter 3/wordcounter.py", line 1, in <module>
         import requests
ImportError: No module named 'requests'




My "import requests" module is not working. He never specifically gave instructions on how to install it so that pycharm would recognize it. Can anyone help I"ve googled it and I can't seem to figure out how to get pycharm to recognize the "import requets" module.

Post a Reply

Replies

Oldest  Newest  Rating
+1 Keshav Trehan · March 30, 2015
SAME THING HAPPENED WITH ME.
JUST GO TO PROJECT INTERPRETER AND INSTALL REQUESTS MODULE.
0 andrew wigginw · March 6, 2015
I have windows not Linux. My buddy gave me a step by step process to install it via the cmd prompt. I now have it installed. But i'm getting a new error.
my code :
 import requests
from bs4 import BeautifulSoup
import operator

def start(url):
word_list = []
source_code = requests.get(url).text
soup = BeautifulSoup(source_code)
for post_text in soup.findAll('a', {'class': 'title may-blank srTagged imgScanned'}):
content = post_text.string
words = content.lower.split()
for each_word in words:
print(each_word)
word_list.append(each_word)
start('http://www.reddit.com/')


Read out:

Traceback (most recent call last):
  File "C:/Users/Andrew/PycharmProjects/untitled/chapter 3/wordcounter.py", line 1, in <module>
    import requests
  File "C:\Python34\lib\site-packages\requests-2.5.3-py3.4.egg\requests\__init__.py", line 53, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "C:\Python34\lib\site-packages\requests-2.5.3-py3.4.egg\requests\packages\urllib3\__init__.py", line 10, in <module>
    from .connectionpool import (
  File "C:\Python34\lib\site-packages\requests-2.5.3-py3.4.egg\requests\packages\urllib3\connectionpool.py", line 2, in <module>
    import logging
  File "C:\Python34\lib\logging\__init__.py", line 40, in <module>
    import threading
  File "C:\Users\Andrew\PycharmProjects\untitled\chapter 3\threading.py", line 3, in <module>
    class BuckysMessenger(threading.Thread):
AttributeError: 'module' object has no attribute 'Thread'
0 Bernard Pyc0d333 Parah · March 6, 2015
hello  Andrew, requests is not installed by default, you will need to install it using pip 

sudo pip install requests



or you can also get it from here
https://pypi.python.org/pypi/requests
  • 1

Python

107,200 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator