win32api.RegQueryValue fails
Mark Hammond
mhammond at skippinet.com.au
Mon Feb 4 02:42:24 EST 2002
Achim Domma wrote:
> Hi,
>
> still not having solved my problem importing win32com in an embedded
> interpreter , I tried to debug where the error comes from. My real problem
> is that win32api.RegQueryValue fails.
>
> The following code works without problems:
>
> import win32api
> print win32api.GetFullPathName(".")
>
> but
>
> import win32api
> keyName = "SOFTWARE\\someKey"
> key = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE , keyName, 0,
> win32con.KEY_ALL_ACCESS)
> win32api.RegQueryValue(key, "Root")
>
> fails with a 'TypeError: this constructor takes no arguments'. If I print
> the handle returned by RegOpenKey it is not Null, so it seems to be ok. A
> look at the implementation of RegQueryValue (head-revision in cvs) showed
> that it is implemented straight forward and I have no idea what should go
> wrong.
>
> I have to use ADO from my embedded python, which will not work without
> win32com, so every little hint is welcome.
Works for me, I'm afraid:
>>> keyName = "SOFTWARE\\Python\\PythonCore\\2.2\\PythonPath"
>>> key = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE , keyName,
0,win32con.KEY_ALL_ACCESS)
>>> win32api.RegQueryValue(key, "")
'f:\\src\\python-2.2\\lib;f:\\src\\python-2.2\\pcbuild'
>>>
Can you send a complete script that fails, using a registry key that I
am likely to have (eg, a Python, standard windows, IE, Office etc setting)
Mark.
More information about the Python-list
mailing list