I am trying to execute this script by Ned Batchelder to switch .py
file association between my two Python installations on Windows. This Python script uses the _winreg
module (winreg
in Python 3.x) to edit certain Registry values (the path and value pairs modified can be seen in the todo
list in the script).
I execute this script as follows:
> SwitchPy.py "C:\Program Files\Python26"
I am getting the following error:
Traceback (most recent call last):
File "C:\Users\SuperUser\SwitchPy.py", line 30, in <module>
key = reg.OpenKey(classes_root, path, 0, reg.KEY_SET_VALUE)
WindowsError: [Error 5] Access is denied
I guessed that it could be something to do with account permissions. But, note that:
The account used above is part of the
Administrators
group and has admin privileges.With the above account I can execute
regedit.exe
and manually set the values listed in the script without facing any permissions or access problems.
I am using Windows 7 and am part of a domain. Could any of this have something to do with this problem?
Does anyone have any clue about this error? How do I make this script run?