我正在尝试运行一个python脚本(https://github.com/swiss-chris/quora-expander),但终端返回错误。
我的意见:
python3 /home/kitezh/quora-expander/quora-expander.py Dima-Vorobiev
终端响应:
opening https://www.quora.com/profile/Dima-Vorobiev
Traceback (most recent call last):
File "/home/kitezh/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: PosixPath('/home/kitezh/chromedriver')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kitezh/quora-expander/quora-expander.py", line 113, in <module>
browser = connectchrome()
File "/home/kitezh/quora-expander/quora-expander.py", line 20, in connectchrome
browser = webdriver.Chrome(executable_path=driver_path, options=options)
File "/home/kitezh/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/kitezh/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 86, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
我该如何解决这个问题?谢谢您的宝贵时间。
更新:
您是否按照消息提示操作并“查看 sites.google.com/a/chromium.org/chromedriver/home”?消息中说了什么?
那是我首先下载 ChromeDriver 93.0.4577.63 的地方。
另外,ls -l /home/kitezh/chromedriver 的输出是什么?
这里是:
total 11908
-rwxrwxrwx 1 kitezh kitezh 12192312 Aug 28 02:00 chromedriver
该文件存在吗?它可以执行吗?
当我输入时chromedriver
,这是终端响应。
Starting ChromeDriver 93.0.4577.63 (ff5c0da2ec0adeaed5550e6c7e98417dac77d98a-refs/branch-heads/4577@{#1135}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
软件包是否需要安装 chrome?如果是,当您在命令行中输入 google-chrome 时,它是否启动时没有任何权限错误?
是的,该软件包需要 Chrome。Google Chrome 启动了,但终端输出以下内容:
[3050:3050:0912/051629.264392:ERROR:viz_main_impl.cc(162)] Exiting GPU process due to errors during initialization
[3113:3113:0912/051629.941247:ERROR:viz_main_impl.cc(162)] Exiting GPU process due to errors during initialization
[3165:3165:0912/051629.979258:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader
[3005:3042:0912/051728.670790:ERROR:persistent_memory_allocator.cc(848)] Corruption detected in shared-memory segment.
@waltinator
探索您的 Mount/Read/Write/Execute 问题 https://github.com/waltinator/pathlld,一个 Bash 脚本。
我运行了这个脚本,结果如下。我的输入:$ pathlld /usr/bin/chromedriver
终端输出:
drwxr-xr-x 20 root root 4096 Sep 10 17:53 /
/dev/sda5 on / type ext4 (rw,relatime,errors=remount-ro)
drwxrwxrwx 14 root root 4096 Aug 19 16:32 /usr
drwxrwxrwx 2 root root 45056 Sep 12 13:48 /usr/bin
-rwxrwxrwx 1 kitezh kitezh 12192312 Aug 28 02:00 /usr/bin/chromedriver