FIXED THE SCRIPT COPY/PASTE below:
HI all -
Maybe you can help me out.
I've been getting this error for ages and it is making me nuts:
Here's the script:
import arcpy, os
folderName = r"S:\AGR\AGR-Shared\AGR-GIS\AGR_Data"
fileName = "Connection to cloud.agriculture.vermont.gov.sde"
filepath = r'S:\AGR\AGR-Shared\AGR-GIS\AGR_Data\Connection to cloud.agriculture.vermont.gov.sde'
serverName = "agr-ofwq2012\AGRGIS"
serviceName = "5151"
databaseName = "AGRGISDATA"
authType = "DATABASE_AUTH"
username = "**********"
password = "**********"
saveUserInfo = "SAVE_USERNAME"
versionName = "SDE.DEFAULT"
saveVersionInfo = "SAVE_VERSION"
arcpy.CreateDatabaseConnection_management(folderName,
fileName,
"SQL_SERVER",
serverName,
authType,
username,
password,
saveUserInfo,
databaseName)
fc = "AGRGISDATA.DBO.ApiariesWGS"
print fc
fc_path = os.path.join(filepath, fc)
print fc_path
fields = ['Longtitude','Latitude','SHAPE@XY']
print fields
arcpy.env.workspace = filepath
workspace = os.path.dirname(filepath)
print workspace
editor = arcpy.da.Editor(workspace)
print editor
editor.startEditing(False, False)
editor.startOperation()
try:
with arcpy.da.UpdateCursor(fc,fields) as cursor:
for row in cursor:
x = row[0]
y = row[1]
xy = (x,y)
pnt = xy
row[2] = pnt
cursor.updateRow(row)
finally:
editor.stopEditing(True)
del editor