Код: Выделить всё
from selenium import webdriver
wd = webdriver.PhantomJS()
Код: Выделить всё
Traceback (most recent call last):
File "/home/jkitchin/.venv/lib/python3.11/site-packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'phantomjs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jkitchin/bots/bibtex/pgs.py", line 3, in
wd = webdriver.PhantomJS()
^^^^^^^^^^^^^^^^^^^^^
File "/home/jkitchin/.venv/lib/python3.11/site-packages/selenium/webdriver/phantomjs/webdriver.py", line 52, in __init__
self.service.start()
File "/home/jkitchin/.venv/lib/python3.11/site-packages/selenium/webdriver/common/service.py", line 79, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
Код: Выделить всё
$ which phantomjs
/usr/bin/phantomjs
Код: Выделить всё
-rwxr-xr-x 1 root root 50179436 Oct 20 13:11 /usr/bin/phantomjs
Этот более простой сценарий также не работает:
Код: Выделить всё
import subprocess as sp
sp.run('phantomjs', capture_output=True)
Код: Выделить всё
Traceback (most recent call last):
File "/home/jkitchin/bots/bibtex/pgs.py", line 5, in
sp.run('/usr/bin/phantomjs', capture_output=True)
File "/usr/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/phantomjs'
Подробнее здесь: https://stackoverflow.com/questions/791 ... -phantomjs