_winreg troubles! HELP!

Mark Hammond MarkH at ActiveState.com
Mon May 21 21:02:16 EDT 2001


Wolfgang Strobl wrote:

> On Mon, 21 May 2001 22:16:13 GMT, Mark Hammond <MarkH at ActiveState.com>
> wrote :


This turns out to be easy:

> hEnvironment = _winreg.OpenKey( h, "Environment", _winreg.KEY_SET_VALUE  )


The docs for _winreg.OpenKey say:

key = OpenKey(key, sub_key, res = 0, sam = KEY_READ) - Opens the 
specified key.


Note that you are passing "KEY_SET_VALUE" as "res", and leaving "sam" 
the default of KEY_READ.

Changing the code to:

hEnvironment = _winreg.OpenKey( h, "Environment",
                                0, _winreg.KEY_SET_VALUE)

Makes it work.

Mark.




More information about the Python-list mailing list