get registry information in python

Steven Nien no-spam at invalide.com
Wed Aug 14 04:04:46 CEST 2002


Hi,

I try to get registry infomation with wmi in python.

from win32com.client import GetObject
HostName="."
HKLM = 0x80000002L
oReg = GetObject("winmgmts:{impersonationLevel=impersonate}//" + HostName +
"/root/default:StdRegProv")
sBaseKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey(HKLM, sBaseKey, sKeys)
for sKey in sKeys:
    print sKey

But when I run the code, I get error message:

Traceback (most recent call last):
  File "D:\steven\ITIM\t1.py", line 6, in ?
    oReg.EnumKey(HKLM, sBaseKey, sKeys)
NameError: name 'sKeys' is not defined

I don't know why 'sKeys' is not defined. Could anybody help
me? Thanks!

--
Steven Nien





More information about the Python-list mailing list