Edit all LineStyle names

in reference to http://dynamobim.org/forums/topic/excel-roundtrip-fill-patterns-line-styles-etc/ I tried to apply the concept to Line Styles names without going through the excel part.
all seems fine until I try the apply the code from @Konrad_K_Sobon. Maybe it is because it is from 2015 and some things have changed in the API

Basically if I keep the code intact I get “unexpected token ‘import’”
and if I remove some of the dependencies I get " the element does not support user specified name "

any clue as to what I am doing wrong would be appreciated:

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

clr.AddReferences(“RevitAPI”)
import Autodesk
import Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

dataEnteringNode = IN

fillPatElems = []
for i in IN[0]:
fillPatElems.append(UnwrapElement(i))
values = IN[1]

TransactionManager.Instance.EnsureInTransaction(doc)
for i,j in zip(fillPatElems, values):
i.Name = j
TransactionManager.Instance.TransactionTaskDone()

OUT = fillPatElems

Given the import warning you got I’m guessing this code might have been copied and pasted from a quote block as you have pasted your code here? It would have turned the apostrophes and quotes into open and close symbols, which will not work in the Python editor, and caused problems with importing. I can’t quite discern what else could be wrong with the imports not having seen pasted as preformatted text.

(code should be pasted as preformatted text using this button here. quote blocks also eliminate indentations which are important)
image

Try copying and pasting the following:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
import System
from System.Collections.Generic import List
doc = DocumentManager.Instance.CurrentDBDocument

dataEnteringNode = IN

fillPatElems = []
for i in IN[0]:
	fillPatElems.append(UnwrapElement(i))
values = IN[1]

TransactionManager.Instance.EnsureInTransaction(doc)
for i,j in zip(fillPatElems, values):
	i.Name = j
TransactionManager.Instance.TransactionTaskDone()

OUT = fillPatElems

thanks for the reply @awilliams
it does clear the import issue.
but I still get the following error:

I feed it with two lists: ids of graphicstyles and new names