title: Python Selenium webdriver throws IOError: [Errno 22] invalid mode ('w') or filename
body: <p><strong>Software version details:</strong>
  Python: 2.7.12 
  OS: Windows 10. 
  Selenium: selenium-2.53.6
  Firefox: 47.0</p>
  
  <p><strong>Code snippet:</strong></p>
  
  <pre><code>import sys, urllib2
  
  from selenium import webdriver
  
  driver = webdriver.Firefox()
  </code></pre>
  
  <p>The last line throws this error:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "queryWebsite.py", line 8,
    in </p>
  
  <pre><code>driver = webdriver.Firefox()
  </code></pre>
    
    <p>File
    "C:\Python27\lib\site-packages\selenium\webdriver\firefox\webdriver.py",
    line 80, in __ init __</p>
  
  <pre><code>self.binary, timeout)   File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\extension_connection.py",
  </code></pre>
    
    <p>line 48, in __ init __</p>
  
  <pre><code>self.profile.update_preferences()   File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py",
  </code></pre>
    
    <p>line 97, in update_preferences</p>
  
  <pre><code>self._write_user_prefs(self.default_preferences)   File "C:\Python27\lib\site-packages\selenium\webdriver\firefox\firefox_profile.py",
  </code></pre>
    
    <p>line 221, in _write_user_prefs
        with open(self.userPrefs, "w") as f:</p>
    
    <p>IOError: [Errno 22] invalid mode ('w') or filename:
    'c:\users\xyz\appdata\local\temp\tmpgwa_ot\user.js'</p>
  </blockquote>
  
  <p>Any idea what is going wrong here?</p>