Reading from the Windows Registry in Python
You can read from the Windows registry in Python. So for instance you can read the location of an application you want to see if it is installed and then run it by finding the installed location of the EXE in the registry, then calling os.command(reg_key_value) or popen2.popen3(reg_key_value) to run it.
import pickle import struct import _winreg def floater (s): return struct.unpack ("f", s)[0] def unpickler (s): return pickle.loads (s) root = _winreg.HKEY_CURRENT_USER key_values = [ (r"Software\PySoft\PyApp", "owner", unicode), (r"Software\PySoft\PyApp", "settings", list), (r"Software\PySoft\PyApp", "version", floater), (r"Software\PySoft\PyApp", "dump", unpickler), ] for keypath, value_name, factory in key_values: hKey = _winreg.OpenKey (root, keypath, 0, _winreg.KEY_READ) value, type = _winreg.QueryValueEx (hKey, value_name) print "%s:%s" % (keypath, value_name), "=>", factory (value)

