使chromedriver在Ubuntu AWS上运行时出现问题

时间:2019-10-26 15:03:23

标签: python amazon-web-services ubuntu amazon-ec2 selenium-chromedriver

使用Ubuntu在让chromedriver在AWS EC2实例上运行时遇到问题。从下图可以看到,我使用FileZilla将chromedriver拖放到我的远程ubuntu站点中,该站点与python脚本本身位于同一文件夹中。然后,我修改了python代码,以便从ubuntu服务器而不是从本地路径访问chromedriver:

options = Options()
driverLocation = webdriver.Chrome(chrome_options=options, 
executable_path=r'/home/ubuntu/bandsintown/chromedriver 4')
driverLocation.quit()

但是,出现以下错误:

   Traceback (most recent call last):
  File "BandsInTown_Scraper_SF.py", line 33, in <module>
    driverLocation = webdriver.Chrome(chrome_options=options, executable_path=r'/home/ubuntu/bandsintown/chromedriver 4')
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/ubuntu/bandsintown/chromedriver 4'

我将不胜感激!谢谢。

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试chromedriver\ 4或从文件名中删除空格。