codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Winreg


I'm running python 3.8 on Windows 8.1 x64. Running the following code
produces no errors but does not add a key, name or value. I had no problems
doing this using _wirreg under python 2.7. Any insight will be helpful.

Code:
===================
import winreg

hive = winreg.HKEY_LOCAL_MACHINE
keypath = 'SOFTWARE\\AAA_Newkey'
host = None
hosthive = winreg.ConnectRegistry( host, hive )
key = winreg.CreateKeyEx( hosthive, keypath, reserved=0,
access=winreg.KEY_WRITE)
winreg.SetValueEx( key, 'NewValueName', 0, winreg.REG_SZ, 'NewStringValue' )
key.Close()
===================