I am trying to get a web2py application running and I have the following code in one of the controllers.
file name : default.py
import requests
def index():
...
In my currently activated virtualenv, I have installed requests using pip, as you can see below.
(web2pyenv) PS C:\Users\rajesh\Desktop\code\RealPython-Part2\web2py> pip install requests
Requirement already satisfied (use --upgrade to upgrade): requests in c:\users\rajesh\desktop\code\realpython-part2\web2py\web2pyenv\lib\site-packages
Cleaning up...
If I open up a python shell, I can import requests and do the usual stuff.
(web2pyenv) PS C:\Users\rajesh\Desktop\code\RealPython-Part2\web2py> python
Python 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.get("http://google.com").status_code
200
>>>
When I try accessing my web2py application, it still throws the following error.
Traceback (most recent call last):
File "gluon/restricted.py", line 224, in restricted
File "C:/Users/rajesh/Desktop/code/RealPython-Part2/web2py/start/applications/pulse/controllers/default.py", line 1, in <module>
import requests
File "gluon/custom_import.py", line 86, in custom_importer
ImportError: Cannot import module 'requests'
Any pointers on what I am doing wrong here?