AnsweredAssumed Answered

Cannot open workspace

Question asked by joanna.grossman on Jan 25, 2017
Latest reply on Feb 7, 2017 by joanna.grossman

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:

 

# Move points based up current lat/lon
#grab stuff you need
import arcpy, os


# Set variables
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"

# Process: Use the CreateArcSDEConnectionFile function
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()

#create curser on fc
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

Outcomes