Python Regular Expression TypeError
<p>I am writing my first python program and I am running into a problem with regex. I am using regular expression to search for a specific value in a registry key.</p>

<pre><code>import _winreg
import re

key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{26A24AE4-039D-4CA4-87B4-2F83216020FF}")

results=[]
v = re.compile(r"(?i)Java")

try:
    i = 0
    while 1:
        name, value, type = _winreg.EnumValue(key, i)
        if v.search(value):
         results.append((name,value,type))
        i += 1
except WindowsError:
    print

for x in results:
 print "%-50s%-80s%-20s" % x
</code></pre>

<p>I am getting the following error:</p>

<blockquote>
  <p>exceptions.TypeError: expected string
  or buffer</p>
</blockquote>

<p>I can use the "name" variable and my regex works fine. For example if I make the following changes regex doesn't complain:</p>

<blockquote>
  <p>v = re.compile(r"(?i)DisplayName")</p>
  
  <p>if v.search(name):</p>
</blockquote>

<p><strong>Thanks for any help.</strong></p>
