from win32api import RegOpenKey, RegQueryValueEx, RegCloseKey
from win32con import HKEY_LOCAL_MACHINE
import sys

hkey = HKEY_LOCAL_MACHINE
subkey = r'Software\Freenet'
name = 'inspath'

hkey = RegOpenKey(hkey, subkey)
freenetdir = RegQueryValueEx(hkey, "instpath")[0]
print freenetdir
RegCloseKey(hkey)