Ryan A
Ryan A

Reputation: 1

Trouble setting up selenium with python3(linux)

Im somewhat a beginner with Python and recently stumbled across the Selenium module, would appreciate it if someone could help me?

I cant seem to get the selenium module working at all with python3. I have downloaded the geckodriver for firefox but still no luck, or am installing it incorrectly maybe?

Im using this code:

from selenium import webdriver

browser = webdriver.Firefox()

And seem to be receiving this error:

'OSError: [Errno 8] Exec format error'

A copy of the whole error message is pasted below.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    File "/home/chron/.local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 140, in __init__
        self.service.start()
      File "/home/chron/.local/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 74, in start
          stdout=self.log_file, stderr=self.log_file)
            File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
            restore_signals, start_new_session)
              File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
                  raise child_exception_type(errno_num, err_msg)
              OSError: [Errno 8] Exec format error

Upvotes: 0

Views: 1240

Answers (1)

Corey Goldberg
Corey Goldberg

Reputation: 60604

OSError: [Errno 8] Exec format error

this looks like it is failing to start geckodriver because you are using a binary that is compiled for the wrong architecture. Make sure you download the correct version for your architecture from https://github.com/mozilla/geckodriver/releases

for example, if you are running 64-bit linux (amd64), you need to download the geckodriver tarball that ends with "linux64.tar.gz".

Upvotes: 1

Related Questions