Problem with winreg - The object is not a PyHKEY object
apt.shansen at gmail.com
Fri Aug 21 19:22:04 CEST 2009
On Fri, Aug 21, 2009 at 9:33 AM, Jamie <jamie.ivanov at gmail.com> wrote:
> My goal is to remotely remove the registry keys for McAfee. I don't
> know how winreg handles an exception if a key doesn't exist, but I
> setup my script to skip the exception. But it doesn't seem to work
> right.. I think the script should be self explanitory, please help!
> Please forgive me, but I'm a python newbie.
> ## SCRIPT ##
> import _winreg
> print "Removing McAfee registry entries"
> hkey = _winreg.ConnectRegistry(r'\
You have to "open" the key first-- the first argument to .DeleteKey is not a
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
The above is an example off the top of my head, not actually tested-- But
that's sorta your problem, I believe: .DeleteKey operates on a key /handle/
in its first argument, not a string. The second argument is a string.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list