Migrating Selenium App from *nix to Windows

I have a working Selenium application on my *nix platform. I am trying to migrate it to windows but am having trouble with ‘webdriver’. Apparently the format for specifying the path to geckodriver.exe is different and I cannot get it right. This is what I have now:

options=Options()
options.set_headless()
browser=webdriver.Firefox(executable_path=r'C:\cygwin64\usr\local\bin\geckodriver.exe',options=options)

This is the traceback I get:

Traceback (most recent call last):
File “C:\home\mysuerid\test.py”, line 89, in
browser=webdriver.Firefox(executable_path=r’C:\cygwin64\usr\local\bin\geckodriver.exe’,options=options)
File “C:\Users\mysuerid\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py”, line 174, in init
keep_alive=True)
File “C:\Users\mysuerid\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 157, in init
self.start_session(capabilities, browser_profile)
File “C:\Users\mysuerid\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File “C:\Users\mysuerid\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 321, in execute
self.error_handler.check_response(response)
File “C:\Users\mysuerid\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 242, in check_respon
se
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Expected browser binary location, but unable to find binary in default location, no ‘moz:firefox
Options.binary’ capability provided, and no binary flag set on the command line

The path to geckodriver.exe is correct so I have no clue what it is looking for.

I finally found the solution. The traceback is actually looking for the firefox executable which is used by geckodriver. In case someone else runs into this the solution is to use ‘FirefoxBinary’.

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
   .
   .
   .
options=Options()
options.binary=FirefoxBinary(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
browser=webdriver.Firefox(executable_path=r'C:\cygwin64\usr\local\bin\geckodriver.exe',options=options)