title: Getting error "pywintypes.error: (5, 'OpenClipboard', 'Access is denied.')"
body: <p>I am trying to use selenium with python to get latitude and longitude from <a href="http://www.whatsmygps.com/" rel="nofollow noreferrer">this</a> site. I am also using win32lipboard. But whenever I run my code, randomly it throws me this error <code>pywintypes.error: (5, 'OpenClipboard', 'Access is denied.')</code>.</p>
  
  <p>This is my code:</p>
  
  <pre><code>from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  import time
  import csv
  import win32clipboard
  
  csvreader = csv.reader(open("master_data.csv", 'r'))
  
  csvwriter = csv.writer(open('final_master_data.csv', 'w', newline=''))
  
  headers = next(csvreader)
  headers.append("latitude")
  headers.append("longitude")
  csvwriter.writerow(headers)
  
  locations = list(csvreader)
  
  chromedriver = 'C:\\Users\\UserName\\Downloads\\chromedriver.exe'
  driver = webdriver.Chrome(chromedriver)
  driver.get('http://www.whatsmygps.com')
  
  for places in locations:
      place = places[6] + ", " + places[4] + ", " + places[2]
  
      location = driver.find_element_by_id("address")
  
      location.send_keys(Keys.CONTROL, 'a')
      location.send_keys(place)
  
      location.submit()
  
      time.sleep(3)
  
      lat_input = driver.find_element_by_id("latitude")
      lat_input.send_keys(Keys.CONTROL, 'a')
      lat_input.send_keys(Keys.CONTROL, 'c')
  
      win32clipboard.OpenClipboard()
      lat = win32clipboard.GetClipboardData()
  
      places.append(lat)
  
      win32clipboard.CloseClipboard()
  
      lon_input = driver.find_element_by_id("longitude")
      lon_input.send_keys(Keys.CONTROL, 'a')
      lon_input.send_keys(Keys.CONTROL, 'c')
  
      win32clipboard.OpenClipboard()
      lon = win32clipboard.GetClipboardData()
      win32clipboard.CloseClipboard()
  
      places.append(lon)
      print(places)
  
      csvwriter.writerow(places)
  
  driver.close()
  </code></pre>
  
  <p>so, whenever I run this code, it starts with no issues, it reads csv file and enter location names into this sites and starts to copy latitude and longitude from the site and insert those into another csv file. But after some time, randomly, it throws error <code>pywintypes.error: (5, 'OpenClipboard', 'Access is denied.')</code>. I am unable to find the solution about this since yesterday.</p>
  
  <p><strong>UPDATE</strong>: I am using Anaconda and I am running anaconda shell as an administrator, so there is no issue with the access permission.</p>