Script to convert embedded blocks to linked?

I can’t make it work :sweat:

    import rhinoscriptsyntax as rs

    def LinkBlock():

    Ids = rs.GetObjects("Select blocks to link.", filter=4096, preselect =True)
    if Ids is None: return

    path = "C:\Users\Shynn\Desktop\BlocksToLink.3dm"

    for Id in Ids:
        name = rs.BlockInstanceName(Id)
        filepath = path + "\\" + name + ".3dm"
        rs.Command("_-BlockManager _Properties " + chr(34) + name + chr(34) + " _UpdateType _Linked path _Enter _Enter", False)

    if name == “main”:
    LinkBlock()

I get this error:

File "C:\Users\Shynn\Desktop\ReplaceBlocksnew.py", line                
SyntaxError: Non-ASCII character '\xe2' in file C:\Users\Shynn\Desktop\ReplaceBlocksnew.py on line 17, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

ReplaceBlocksnew.py (518 Bytes)