requests: 'module' object has no attribute 'get'

Question:

I installed the requests package last week and it worked fine.. Until this morning. I coded this and I got the AttributeError: 'module' object has no attribute 'get' message:

import requests

r = requests.get('http://www.yellowpages.com/search?search_terms=coffee&geo_location_terms=Montreal%2C+QC')

I read in other posts that it might be because I have more than one requests packages installed.
When I code print(dir(requests)) I get two lists..:

['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__',
'requests']

['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__',
'requests']

Any help will be appreciated.

Sylvain

Asked By: Sylvain

||

Answers:

Is it possible that you named your script requests.py or that you have a similarly named file in the same directory?

Answered By: Alec