_winreg newbie question
the_3_project at yahoo.com
Tue Apr 29 07:56:31 CEST 2003
I'm having trouble understanding why _winreg.OpenRegistry() does not
want to open the registry in a class.
An example is something like
from _winreg import *
s = 'HKEY_LOCAL_MACHINE'
if (s is 'HKEY_LOCAL_MACHINE'):
reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
print "Somehow that didn't work"
That seems to work fine. But when it's inside a class
def __init__(self, key, cname=None):
if (cname is 'HKEY_LOCAL_MACHINE'):
self.reg = ConnectRegistry(cname, HKEY_LOCAL_MACHINE)
print "Not working"
it doesn't work. self.reg never points to anything.
More information about the Python-list