title: Can't find Windows registry entry, but it's visible in regedit
body: <p>I'm searching for an uninstall string for a specific publisher to automate uninstalling some software.  I can see the entry in regedit. I'm searching both the 64 bit and 32 bit registry views as can be seen in my code.  I can see the application in Add or Remove Programs.  The software is published by Environmental Research Systems Institute, Inc.  I've searched all over and can't figure out why I can't find this key with my code. Any help would be appreciated.  In the function <code>getUninstallers</code> there is an if statement commented out in the first try block that has the actual key name I'm trying to find.  Below the code I've included a screenshot of regedit with the key visible.</p>
  
  <pre><code>import winreg 
  aKeyName = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
  bKeyName = "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
  
  def getUninstallers(keyName, bitView):
      if ( bitView == 32 ):
          key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyName, 0,
                  (winreg.KEY_WOW64_32KEY + winreg.KEY_READ))
      elif ( bitView == 64 ):
          key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyName, 0,
                  (winreg.KEY_WOW64_64KEY + winreg.KEY_READ))
      subKeyIndex = 0
      subkeys = list()
      while True:
          try:
              subKeyName = winreg.EnumKey(key,subKeyIndex)
              #if(subKeyName.count(r'{D43E583A-A698-4227-8F83-3084172F12F0}') &gt; 0):
              #    print(subKeyName)
              subKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, keyName +
                          "\\" + subKeyName)
              valueIndex = 0
              subKeyList = list()
              while True:
                  try:
                      aValue = winreg.EnumValue(subKey,valueIndex)
                      if(aValue[0] == 'Publisher' or 
                         aValue[0] == 'UninstallString'):
                          subKeyList.append(aValue)
                      valueIndex+=1
                  except OSError:#[WinError 259] No more data is available
                      #These errors are supposed to happen, see winreg 
                      #documentation at docs.python.org/3/library/winreg.html
                      break
              if(len(subKeyList) &gt; 0):
                  subkeys.append(subKeyList)
              subKeyIndex += 1
          except OSError:#[WinError 259] No more data is available
              #These errors are supposed to happen, see winreg documentation
              #at docs.python.org/3/library/winreg.html
              break
      return subkeys
  
  def getUninstallersByPublisher(publisher):
      theKeys = [getUninstallers(aKeyName, 32), 
                 getUninstallers(bKeyName, 32), 
                 getUninstallers(aKeyName, 64), 
                 getUninstallers(bKeyName, 64)]
      uninstallers = list()
      for aKey in theKeys:
          for subKey in aKey:
              for aValue in subKey:
                  for aString in aValue:
                      if(str(aString).count(publisher) &gt; 0):
                          print("Found key for publisher: " + publisher)
                          for someValue in subKey:
                              for someString in someValue:
                                  if(str(someString).count("Uninstall") &gt; 0):
                                      try:
                                          print("Found UninstallString: " +
                                              someValue[1])
                                          uninstallers.append(someValue[1])
                                      except Exception as e:
                                          print("exception: " + str(e))
      # Delete duplicates in list                                        
      uninstallers = list(set(uninstallers))
      return uninstallers
  
  
  print(getUninstallersByPublisher(
          "Environmental Systems Research Institute, Inc."))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/gbFJs.png" rel="nofollow noreferrer">Picture of regedit with the key visible</a></p>