Я недавно скопировал записную книжку Jupyter со своего Mac на мой сервер Ubuntu. Я создал блокнот на Mac. Я использую селен в записной книжке, и когда я запускаю приведенный ниже код, он выдает ошибку ниже. Я проверил путь файла к chromedriver на моем сервере Ubuntu с помощью pwd, и он вернул:
/home/username/stuff/JobHuntCode/
Кто-нибудь знает, в чем может быть проблема?
Код:
driver = webdriver.Chrome(executable_path=os.path.abspath("/home/username/stuff/JobHuntCode/chromedriver"), chrome_options=chrome_options)
Ошибка:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-9-d3b93e4dc168> in <module>
15 chrome_options = Options()
16 options.add_argument('headless') #downlod Chrome driver.exe
---> 17 driver = webdriver.Chrome(executable_path=os.path.abspath("/home/username/stuff/JobHuntCode/chromedriver"), chrome_options=chrome_options)
18
19
~/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
71 service_args=service_args,
72 log_path=service_log_path)
---> 73 self.service.start()
74
75 try:
~/anaconda3/envs/py36/lib/python3.6/site-packages/selenium/webdriver/common/service.py in start(self)
74 stdout=self.log_file,
75 stderr=self.log_file,
---> 76 stdin=PIPE)
77 except TypeError:
78 raise
~/anaconda3/envs/py36/lib/python3.6/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
727 c2pread, c2pwrite,
728 errread, errwrite,
--> 729 restore_signals, start_new_session)
730 except:
731 # Cleanup if the child failed starting.
~/anaconda3/envs/py36/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1362 if errno_num == errno.ENOENT:
1363 err_msg += ': ' + repr(err_filename)
-> 1364 raise child_exception_type(errno_num, err_msg, err_filename)
1365 raise child_exception_type(err_msg)
1366
OSError: [Errno 8] Exec format error: '/home/username/stuff/JobHuntCode/chromedriver'