I have no idea what the issue is here, I created this scripting tool which works fine when I run it through ArcGIS desktop. However, for some reason, I am unable to publish the tool as a service.The following is the error (00178) that I keep receiving:

"Data: \, used by script cannot be copied to the server". The script is very simple as it is just doing a simple calculation derived from a feature class which is currently stored on the SDE geodatabase. I've already looked through the documentation and none of the solution seems to resolve my issue.

    import arcpy, csv, datetime

    output = arcpy.GetParameterAsText(0)
    DATA = r'C:\!PROD_Connections_SDE\PROD@ABC.sde\ABC.PROD.S2_testbuild\ABC.PROD.ABC_testline'

    #table = arcpy.MakeFeatureLayer_management(DATA,"data")

    # Map of UTM Zone WKIDs, modify as needed
    utmZones = {10: 32610,
        11: 32611,
        12: 32612,
        13: 32613}

        pLength = 0.0
        hLength = 0.0

       def getUTMZone(geometry):
           from math import floor
           geo = geometry.projectAs(arcpy.SpatialReference(4326))
           lon = geo.trueCentroid.X
           return int(floor((lon + 180)/6) + 1)

       with arcpy.da.SearchCursor(DATA,["SHAPE@","Activity"]) as cur:
           for row in cur:
               utmZone = getUTMZone(row[0])
               sr = arcpy.SpatialReference(utmZones[utmZone])

               # Project line to correct UTM zone and add its length to the correct sum
               geom = row[0].projectAs(sr)
               if row[1] == "HDD":
                   hLength += geom.length
                   pLength += geom.length

       # Write data to CSV
       with open(output,'wb') as outFile:
           date = datetime.datetime.today()
           headers = ("Date","P Total Length (m)","H Total Length (m)")
           record = (str(date),str(plength),str(hlength))
           writer = csv.writer(outFile)
  • 1
    Please edit the question to contain the full error message as text. Have you tried resolving the error as per the documentation? – Vince Jul 7 '15 at 21:59
  • of course i have – bobsays48 Jul 7 '15 at 22:06
  • 1
    Then please edit the question to include the details of the procedure you used to register your data source with the server. – Vince Jul 7 '15 at 22:26
  • Your indentation on def getUTMZone(geometry): seems to be astray, but in any event I think you should try publishing just a snippet of code as a Geoprocessing Service first, before returning to your full code. – PolyGeo Jul 8 '15 at 3:32
  • 1
    What version of AGS? Based on this: Data: \,, my best guess is the SDE data. There is no where else in your script with a " \ ". However its strange it is just the slash and not the full path to the dataset. – KHibma Jul 8 '15 at 16:18

The analyser likes to pick out random items and claim the script is using them, for example this post on Geonet.

I got round the problem by putting the SDE connection file on a network share that the server could also see and referencing it with a full UNC path:

INWorkspace = r"\\store\UTILITIES\SDE Connections\xxx_geodb.sde"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.