extending PATH on Windows?
Ulli Horlacher
framstag at rus.uni-stuttgart.de
Thu Feb 18 11:55:29 EST 2016
Ulli Horlacher <framstag at rus.uni-stuttgart.de> wrote:
> > but simpler still and more reliable to just call QueryValueEx.
>
> I find it more complicated.
I have now (after long studying docs and examples)::
def get_winreg(key,subkey):
try:
rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_READ)
rvalue,rtype = winreg.QueryValueEx(rkey,subkey)
winreg.CloseKey(rkey)
except WindowsError:
rvalue,rtype = None,None
return rvalue
def set_winreg(key,subkey,value):
winreg.CreateKey(winreg.HKEY_CURRENT_USER,key)
rkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER,key,0,winreg.KEY_WRITE)
winreg.SetValueEx(rkey,subkey,0,winreg.REG_SZ,value)
winreg.CloseKey(rkey)
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher at tik.uni-stuttgart.de
Universitaet Stuttgart Tel: ++49-711-68565868
Allmandring 30a Fax: ++49-711-682357
70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
More information about the Python-list
mailing list