readregistry issue

Go To StackoverFlow.com

1

I'm sure that there's something silly that I'm missing here..

I'm trying to query the registry (Windows 7 64bit) to get my Python install path. For some reason, I'm getting:

Registry Path Not Found! - key=3D'SOFTWARE\Python\PythonCore\2.7\InstallPath\';hive=3D'LocalMachine'

However, if I replace my key with the sample in the documentation, all works fine. I've rebooted since installing Python (not sure whether or not that makes a difference). What am I missing here?

The task I'm using is:

<readregistry verbose="true" key="SOFTWARE\Python\PythonCore\2.7\InstallPath\" property="installDir" />
2012-04-04 18:25
by Demian Brecht
Does it really exists? You can check it from cmd with reg query HLKM\SOFTWARE\Python\PythonCore\2.7\InstallPath\ /v installDir. E.g. I don't have such key. I have XP 32 bit, though - kirilloid 2012-04-04 18:30
Yessir.. reg query HKLM\SOFTWARE\Python\PythonCore\2.7\InstallPath\ /ve yields the correct path - Demian Brecht 2012-04-04 19:03
Are you sure, hive key should be named as LocalMachine and not as HKLM, LOCAL_MACHINE or HKEY_LOCAL_MACHINE - kirilloid 2012-04-04 19:09
Yes. That's as per nant docs - Demian Brecht 2012-04-04 19:10
Could this be an issue with registry key redirection: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384253%28v=vs.85%29.aspx#redirectedsharedandreflectedkeysunderwow6 - The Chairman 2012-04-06 07:36


1

The 'readregistry' task 'key' attribute is misleading.
It does not represent the registry key but instead the key and value name.
So to get the value of 'installDir' from the 'HLKM\SOFTWARE\Python\PythonCore\2.7\InstallPath' key,
and then set it in a property named 'somePropName', what you have to do is :

<readregistry property="somePropName" key="SOFTWARE\Python\PythonCore\2.7\InstallPath\installDir" hive="LocalMachine" />
2013-05-01 18:21
by jfbriere
Ads