# syntaxError: EOL while scanning string literal

433
1
02-07-2022 10:18 PM
New Contributor

Hi guys,

I am trying to make a new filter with makeFeatureLayer_management . it works fine in arcgis pro as standalone script but while running as a geoprocessing service it shows me an error :

• esriJobMessageTypeError: File "<string>", line 31 arcpy.MakeFeatureLayer_management(CADSrs, CADlyr,g_ESRI_variable_3'") ^ SyntaxError: EOL while scanning string literal

the code snippet :

arcpy.MakeFeatureLayer_management(CADSrs, CADlyr,"\"Layer\" = 'karar'")

My question is there any different way to make this filter with python "\"Layer\" = 'karar'"?

I've tried to add r before But it didn't works for me.

MVP Esteemed Contributor

building the whereclause depends on the source of the data.

fc = r"C:\a_path\to\a\file_geodatabase.gdb\featureclass_name"
"Name_2 = 'bob'"