Jake,
Many thanks for script but I get the following error message. Note that I changed the folder paths to the shapefile and raster inputs. The field "LineNum" is a text field if that is an issue.
>>> import arcpy
arcpy.env.overwriteOutput = 1
shapefile = r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\LineBuf.shp"
raster = r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\MN_DEM3second"
with arcpy.da.SearchCursor(shapefile, "LineNum") as cursor:
for row in cursor:
print("Creating Feature Layer for " + str(row[0]))
arcpy.MakeFeatureLayer_management(shapefile, "fLayer", "LineNum = " + row[0])
print("Clipping raster")
arcpy.Clip_management(raster, "", r"S:\General-Offices-GO-Trans\SLR-Mapping\GIS_Projects_2018\Smart_T_Line_Model\geodata\DEM_" + str(row[0]), "", "fLayer", "MAINTAIN_EXTENT")
del cursor
Creating Feature Layer for 0517
Runtime error Traceback (most recent call last): File "<string>", line 10, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 6520, in MakeFeatureLayer raise e ExecuteError: ERROR 000358: Invalid expression LineNum = 0517 Failed to execute (MakeFeatureLayer).
>>>