From c14bf5e2d55b616d43abb3e9ffc6304603ee6d16 Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Thu, 12 Jan 2017 22:54:48 +0000 Subject: [PATCH] Get `chromedriver` path from the system path This is cross platform and avoids the need to download Chrome Driver to the project directory. --- audible-activator.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/audible-activator.py b/audible-activator.py index 75fa9a2..6f248a8 100755 --- a/audible-activator.py +++ b/audible-activator.py @@ -14,6 +14,7 @@ import requests import os import common import binascii +import distutils.spawn def fetch_activation_bytes(username, password, options): @@ -48,10 +49,7 @@ def fetch_activation_bytes(username, password, options): 'openid.return_to': base_url + 'player-auth-token?playerType=software&playerId=%s=&bp_ua=y&playerModel=Desktop&playerManufacturer=Audible' % (player_id) } - if sys.platform == 'win32': - chromedriver_path = "chromedriver.exe" - else: - chromedriver_path = "./chromedriver" + chromedriver_path = distutils.spawn.find_executable('chromedriver') driver = webdriver.Chrome(chrome_options=opts, executable_path=chromedriver_path)