As noted in the answer to my question here, setting the path to chromedriver in binaries
in the Pyinstaller spec file (binaries=[(\'/usr/bin/chromedriver\
I succesfully bundled chromedriver with pyinstaller (although unfortunately, my virusscanner flagged it, after I ran the exe, but that's another problem)
I guess your problem is that you do not give the correct path to the webdriver in the script (using keyword executable_path). Also, I included the chromedriver as a data-file, although I'm not sure if that makes a difference..
Here is my example.
sel_ex.py:
from selenium import webdriver
import os, sys, inspect # http://stackoverflow.com/questions/279237/import-a-module-from-a-relative-path
current_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe() ))[0]))
def init_driver():
chromedriver = os.path.join(current_folder,"chromedriver.exe")
# via this way, you explicitly let Chrome know where to find
# the webdriver.
driver = webdriver.Chrome(executable_path = chromedriver)
return driver
if __name__ == "__main__":
driver = init_driver()
driver.get("http://www.imdb.com/")
sel_ex.spec:
....
binaries=[],
datas=[("chromedriver.exe",".")],
....
In this way, the chromedriver was stored in the main folder, although it should not matter where it is stored, as long as the script correct path through the keyword executable_path
disclaimers: -I did not use the one-file-settings, but that shouldn't make a difference. -my OS is windows