def _get_win_folder_from_registry(csidl_name):
 import _winreg
 shell_folder_name = {'CSIDL_APPDATA': 'AppData', 'CSIDL_COMMON_APPDATA': 'Common AppData', 'CSIDL_LOCAL_APPDATA': 'Local AppData'}[csidl_name]
 key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders')
 (directory, _type) = _winreg.QueryValueEx(key, shell_folder_name)
 return directory

def _get_win_folder_from_registry ( csidl_name ) : import _winreg shell_folder_name = { 'CSIDL_APPDATA' : 'AppData' , 'CSIDL_COMMON_APPDATA' : 'Common AppData' , 'CSIDL_LOCAL_APPDATA' : 'Local AppData' } [ csidl_name ] key = _winreg . OpenKey ( _winreg . HKEY_CURRENT_USER , 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders' ) ( directory , _type ) = _winreg . QueryValueEx ( key , shell_folder_name ) return directory
this is a fallback technique at best .