Search Results

Search found 1 results on 1 pages for 'spaghettiwestern'.

Page 1/1 | 1 

  • Python Regular Expression TypeError

    - by spaghettiwestern
    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. 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 I am getting the following error: exceptions.TypeError: expected string or buffer I can use the "name" variable and my regex works fine. For example if I make the following changes regex doesn't complain: v = re.compile(r"(?i)DisplayName") if v.search(name): Thanks for any help.

    Read the article

1