title: NotADirectoryError: [WinError 267] The directory name is invalid error while invoking Firefox through Selenium Python
body: <p>I'm trying to invoke a firefox browser using Selenium webdriver from below python code.. </p>
  
  <pre><code>from selenium import webdriver
  
  # Initializing the WebDriver for Firefox browser
  driver = webdriver.Firefox("C:\\selenium\\mozilla\\geckodriver.exe")
  driver.set_page_load_timeout(30)
  driver.maximize_window()
  driver.get("https://www.google.com/")
  
  # Closing the reference
  driver.quit()
  </code></pre>
  
  <p>but it is always throwing an error like below, however this is working for Chrome browser.</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:/Python/Practice/FirefoxSample.py", line 8, in &lt;module&gt;
      driver = webdriver.Firefox("C:\\selenium\\mozilla\\geckodriver.exe")
    File "C:\Python\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 139, in __init__
      firefox_profile = FirefoxProfile(firefox_profile)
    File "C:\Python\venv\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py", line 78, in __init__
      ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
    File "C:\Python\Python36-32\lib\shutil.py", line 309, in copytree
      names = os.listdir(src)
  NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\selenium\\mozilla\\geckodriver.exe'
  
  Process finished with exit code 1
  </code></pre>
  
  <p>What am I missing here? </p>
  
  <p>I have also tried upgrading the selenium package using the pip</p>
  
  <pre><code>pip install -U selenium
  </code></pre>
  
  <p><strong>Additional info:</strong> running the Firefox latest version (59.0.2), Python (3.6.5) and Selenium Gecko webdriver (0.20.0). Not sure if anything is needed to help on this.</p>