_winreg.DeleteValue - Permission denied ...
brueckd at tbye.com
brueckd at tbye.com
Fri Sep 27 10:40:02 EDT 2002
On Fri, 27 Sep 2002, Harald Schneider wrote:
> When I try to delete a registry key, I get a WindowsError (Errno5) /
> Permission denied, even thought I am logged in as admin.
> Deleting the same key with regedit works.
>
> The function looks like this:
>
> def del_cfg_path(self):
> key =
> _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,'SOFTWARE\TEST\SUBTEST)
> _winreg.DeleteValue(key,"TESTVAL")
> _winreg.CloseKey(key)
>
> Any ideas ?
Hi Harald,
Perhaps you need to open the registry key with write permissions, e.g.:
key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, \
'SOFTWARE\\TEST\\SUBTEST', \
0, _winreg.KEY_ALL_ACCESS)
(Also note that you should use double backslashes in your strings or use
raw strings)
HTH,
Dave
More information about the Python-list
mailing list