Winreg

R Pasco pascor22234 at gmail.com
Wed Jul 29 14:46:04 EDT 2020


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()
===================


More information about the Python-list mailing list