Hi guys,
I am new to python , I am trying to read some data from CAD file using the below script , the script is works fine on Arcgis Pro 2.9.1 with no Errors But after publishing this to Arcgis server(10.9.1) as Geo-processing service and Submitting a job (post) the job fails and showing me the following :
-
- esriJobMessageTypeError: File "<string>", line 31 arcpy.MakeFeatureLayer_management(CADSrs, CADlyr,g_ESRI_variable_3'") ^ SyntaxError: EOL while scanning string literal
- esriJobMessageTypeError: Failed to execute (ImportCad).

my script :
# Import system modules
import arcpy
arcpy.env.workspace = arcpy.GetParameterAsText(0)
Request_ID = arcpy.GetParameterAsText(1)
print(arcpy.env.workspace)
# Step through each dataset in the list
for fd in arcpy.ListDatasets("*"):
layers = ["Polyline", "Polygon", "Point"]
for lyrGeom in layers:
print(lyrGeom)
CADlyr = fd + "_" + lyrGeom
CADSrs = fd + "/" + lyrGeom
print(CADlyr)
# Select the features on the drawing layer karar
arcpy.MakeFeatureLayer_management(CADSrs, CADlyr, "\"Layer\" = 'karar'")
with arcpy.da.SearchCursor(CADlyr,
["SHAPE@", "SHAPE@WKT", "OID@", "SHAPE@AREA", "SHAPE@LENGTH", "SHAPE@XY",
"Layer"]) as cursor:
for row in cursor:
print("Feature {}:".format(row[2]))
arcpy.AddMessage("Feature {}:".format(row[2]))
print("Value of Spatial Reference = {}".format(row[0].spatialReference.name))
sr = arcpy.SpatialReference(32637)
newG = row[0].projectAs(sr)
print (sr.name)
arcpy.SetParameterAsText(2, sr.name)
the problem at the "\"Layer\" = 'karar'" filter not accepted on runtime .
Reference of my code
any idea how to solve this ,
thanks for advance for your help,