The Arcpy documentation seems to suggest that when writing python scripts that utilize/modify variables in arcpy.env, you should wrap everything in a bunch of try/except/(finally) loops with custom error types (which are generally a bad practice, IMO).
The the case here, they don't even guard against errors leaving the extension checked out:
import arcpy import arcpyproduction # Check out Production Mapping license arcpy.CheckOutExtension("Foundation") # Define map document, data frame, and polygon geometry coordinates [snip] # Create polygon geometry for coordPair in coordList: x, y = coordPair.split(";") pnt = arcpy.Point(x,y) array.add(pnt) array.add(array.getObject(0)) boundaryPolygon = arcpy.Polygon(array) [snip] # Check in extension arcpy.CheckInExtension("Foundation") I know that's not a huge risk, but there's got to be a better way, right?
أكثر...
The the case here, they don't even guard against errors leaving the extension checked out:
import arcpy import arcpyproduction # Check out Production Mapping license arcpy.CheckOutExtension("Foundation") # Define map document, data frame, and polygon geometry coordinates [snip] # Create polygon geometry for coordPair in coordList: x, y = coordPair.split(";") pnt = arcpy.Point(x,y) array.add(pnt) array.add(array.getObject(0)) boundaryPolygon = arcpy.Polygon(array) [snip] # Check in extension arcpy.CheckInExtension("Foundation") I know that's not a huge risk, but there's got to be a better way, right?
أكثر...