_winreg troubles! HELP!

Samuel A. Falvo II kc5tja at dolphin.openprojects.net
Mon May 21 15:43:46 EDT 2001


OK, I'm currently using _winreg module under Python 2.1.  Here's the code
that I'm working on interactively right now:

>>> from _winreg import *
>>> h = ConnectRegistry( None, HKEY_CURRENT_USER )
>>> hEnvironment = OpenKey( h, "Environment", KEY_READ | KEY_WRITE )
>>> ( value, type ) = QueryValueEx( hEnvironment, "PATH" )
>>> value = value + ";c:\myProgram\bin"
>>> SetValueEx( hEnvironment, "PATH", 0, type, value )
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
WindowsError: [Errno 5] Access is denied

The problem I'm having is that I'm running as an administrator of this NT
machine.  Yet, it's still giving me access denied errors, even though I
opened the Environment key for both reading and writing.  What am I
overlooking?

Thanks.

-- 
KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA



More information about the Python-list mailing list