centos PermissionError: [Errno 13] Permission denied: 'geckodriver'

运行一个爬虫文件时运到错误 centos PermissionError: [Errno 13] Permission denied: 'geckodriver'

Traceback (most recent call last):
  File "/home/crawl/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: 'geckodriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/crawl/scra_djan/crawl.py", line 598, in 
    main()
  File "/home/crawl/scra_djan/crawl.py", line 570, in main
    yangguang(type=6)
  File "/home/crawl/scra_djan/crawl.py", line 418, in yangguang
    driver = webdriver.Firefox(options=chrome_options)
  File "/home/crawl/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
    self.service.start()
  File "/home/crawl/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 88, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable may have wrong permissions. 

网上没有相应的博客,因此我大展身手的机会又来了

原因:爬虫文件无法调用 'geckodriver'

解决方案:更改 'geckodriver'权限

centos PermissionError: [Errno 13] Permission denied: 'geckodriver'_第1张图片

更改执行权限

centos PermissionError: [Errno 13] Permission denied: 'geckodriver'_第2张图片

完美解决

你可能感兴趣的:(杂记)