def _winreg_getShellFolder( name ):
    """Get a shell folder by string name from the registry"""
    k = _winreg.OpenKey(
        _winreg.HKEY_CURRENT_USER,
        r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
    )
    try:
        # should check that it's valid? How?
        return _winreg.QueryValueEx( k, name )[0]
    finally:
        _winreg.CloseKey( k )
def _winreg_getShellFolder ( name ) : k = _winreg . OpenKey ( _winreg . HKEY_CURRENT_USER , r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ) try : return _winreg . QueryValueEx ( k , name ) [ 0 ] finally : _winreg . CloseKey ( k )
Get a shell folder by string name from the registry