I have a Python script on my Dreamhost shared server. When I access my script via SSH (using the UNIX Shell) my script executes fine and is able to import the Pycrypto module Crypto.Cipher.
But if I access my script via HTTP using my websites url. The script fails when it goes to import the Pycrypto module Crypto.Cipher. It gives the error ImportError: No module named Crypto.Cipher.
Do you know what might be causing this weird error? And how I can fix it.
Some important information:
 - I have installed a custom version of python on my shared server. Its just Python 2.7 with Pycrypto and easy_install installed.
- I am certain that the script is running under Python 2.7 and not Dreamhosts default 2.6 version. I know this because the script prints sys.version_info(major=2, minor=7, micro=0, releaselevel='final', serial=0) both in the UNIX shell and HTTP.
- I installed Pycrypto manually (using tar, and running setup.py) as opposed to using easy_install or pip.
- I have editted my .bash_profile's PATH variable correctly (well I believe I have done it correctly because the script is run under Python 2.7 not 2.6).
Any advice would be extremely helpful.
Your web server does not read your .bash_profile.
Shared Server: Python Script run under UNIX Shell vs HTTP