I am executing python script from php which is importing webdriver from selenium but I am getting error
Traceback (most recent call last): File "/var/www/html/spreadsheet/script.py", line 10, in from selenium import webdriver ImportError: No module named selenium
Selenium is installed and python script is working perfectly from bash. i have also run it from sudo but still getting the same error.
my php script is
$dir = __DIR__;
$command = "sudo -u www-data python ".$dir."/script.py 2>&1";
$pid = popen( $command,"r");
while( !feof( $pid ) )
{
echo fread($pid, 256);
flush();
ob_flush();
usleep(200000);
}
pclose($pid);
and in script.py i am getting eror
from selenium import webdriver
import time
import os
import os.path
so i am getting error while importing webdriver.
1 Answer 1
Is the selenium module installed? if not installed it using pip install selenium --> for Python 2.7 and above pip3 install selenium --> for Python3.^ and above
Comments
Explore related questions
See similar questions with these tags.
bash -c?