def recurse_delete_key(path, base=win32con.HKEY_CLASSES_ROOT):
 try:
  h = win32api.RegOpenKey(base, path)
 except win32api.error as (code, fn, msg):
  if (code != winerror.ERROR_FILE_NOT_FOUND):
   raise win32api.error(code, fn, msg)
 else:
  try:
   while 1:
    try:
     subkeyname = win32api.RegEnumKey(h, 0)
    except win32api.error as (code, fn, msg):
     if (code != winerror.ERROR_NO_MORE_ITEMS):
      raise win32api.error(code, fn, msg)
     break
    recurse_delete_key(((path + '\\') + subkeyname), base)
   _remove_key(path, base)
  finally:
   win32api.RegCloseKey(h)

def recurse_delete_key ( path , base = win32con . HKEY_CLASSES_ROOT ) : try : h = win32api . RegOpenKey ( base , path ) except win32api . error as ( code , fn , msg ) : if ( code != winerror . ERROR_FILE_NOT_FOUND ) : raise win32api . error ( code , fn , msg ) else : try : while 1 : try : subkeyname = win32api . RegEnumKey ( h , 0 ) except win32api . error as ( code , fn , msg ) : if ( code != winerror . ERROR_NO_MORE_ITEMS ) : raise win32api . error ( code , fn , msg ) break recurse_delete_key ( ( ( path + '\\' ) + subkeyname ) , base ) _remove_key ( path , base ) finally : win32api . RegCloseKey ( h )
recursively delete registry keys .