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):
#http://gis.stackexchange.com/questions/13291/computing-utm-zone-from-lat-long-point
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
else:
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)
writer.writerow(headers)
writer.writerow(record)
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