This is my first time posting to a discussion board. I am in the process of taking Penn State's Geog 485 course on Python and GIS and I am stuck on an exercise.
Here is the url of the exercise: https://community.esri.com/discussion/create.jspa?sr=cmenu&containerType=14&containerID=1&draftID=31201
If anyone has any suggestion on how to make this code work or what I am doing wrong, I would really appreciate it
import arcpy #Set workspace environment arcpy.env.workspace = "C:\\Users\\jtodd\\Dropbox\\PennState_OnlineCourses\\WCGIS\\Geog485\\Lesson2\\Lesson2Data" #Input feature classes input_features = arcpy.ListFeatureClasses() #Output workspace output_workspace = "C:\\Users\\jtodd\\Dropbox\\PennState_OnlineCourses\\WCGIS\\Geog485\\Lesson2\\Lesson2Data\\results" #template dataset template = "Ferries.shp" try: #Geographic transformation - Determines 'template' spatial reference desc = arcpy.Describe(template) templateSR = desc.spatialReference #print templateSR.Name #Check to make sure code is working up to this point for featureClass in input_features: desc = arcpy.Describe(featureClass) fcListSR = desc.SpatialReference #print fcListSR.Name #Check to make sure code is working up to this point if fcListSR.Name != templateSR.Name: arcpy.DefineProjection_management(input_features, templateSR) print(arcpy.GetMessages(0)) except arcpy.ExecuteError: print(arcpy.GetMessages(2)) except Exception as ex: print(ex.args)