I have a python script tool that I publish as a geoprocessing service. There are several places in my code where I want to split the longName of a layer into its components using the python split() method:
prefix = lyr.longName.split("\\")[0]
However, when the script tool is published, the code transformation that ArcGIS Server applies detects the "\\" string as a path and assigns it to an g_ESRI_variable that causes the code to fail. Here is code that exists in ArcGIS server extracted/ folder
g_ESRI_variable_2 = os.path.join(arcpy.env.packageWorkspace, u'arctoolbox')
....
prefix = lyr.longName.split(g_ESRI_variable_2)[0]
Is there a way to indicate that a particular string literal should be let alone? Or perhaps an alternative way of performing the split that will not trigger the path replacement?