Using ArcGIS 10.2.2 I am trying to set the extent in environment settings using arcpy.env.extent
My code is here:
for lyrVec in arcpy.mapping.ListLayers(mxd, "", df):
if lyrVec.name == "Thresholds":
desc = arcpy.Describe(lyrVec)
lyrVecPath = desc.path + '\\' + str(lyrVec) + '.shp'
fixedpath = os.path.normpath(lyrVecPath)
arcpy.env.extent = lyrVecPath
Error message is thrown up:
RuntimeError: Object: Error in accessing environment
lyrVecPath
? I suspect that it may not be a reachable dataset but, in any event, what you have provided here appears to be a copy/paste of some code from your script instead of a code snippet that works up to where you are stuck.fixedpath = os.path.normpath(lyrVecPath)
but still usearcpy.env.extent = lyrVecPath
instead ofarcpy.env.extent = fixedpath
. Is there a reason you needed to fix the path?