Search code examples
phppythonseleniumhostmonster

Import selenium error on hostmonster shared linux server


I have created a python script that uses selenium to automate an online task. The script works perfect on my local machine (windows 7) and gives the output i am looking for. I am now trying to get it up and running from PHP on my hostmonster shared server which is running linux and having no luck.

I have installed this version of selenium on both my win7 comp and the server: pypi.python.org/pypi/selenium
Python version: 2.7.5
The script i wrote gets the following error at "import selenium":ImportError: No module named selenium

When i log into the server through ssh shell, i can type in "import selenium" and receive no errors. I can also type in "from selenium import webdriver" in the ssh shell and receive no errors.
Any help/guidance would be greatly appreciated.


Solution

  • I have resolved the issue. I used the following command to install selenium outside of the python folder.
    easy_install --prefix=$HOME/.local/ selenium
    I also added these lines at the bottom of my .bashrc file located in my home directory
    export PYTHONPATH=$HOME/.local/lib/python/site-packages:$PYTHONPATH
    export PYTHONPATH=$HOME/.local/lib/python2.7/site-packages:$PYTHONPATH
    export PATH=$HOME/.local/bin:$PATH