Hi,
I have a List index out of range problems. I think that's come from my delete field operation but I'm not sure. Any ideas ???
The resulting layers of my script are what I'm suppose to have. Anyone have a solution to my problem.
Here the errors I have :
Thanks you
I have a List index out of range problems. I think that's come from my delete field operation but I'm not sure. Any ideas ???
The resulting layers of my script are what I'm suppose to have. Anyone have a solution to my problem.
Code:
# Suppresion des champs récurents
# Delete duplicating fields
DropField = ("FacilityID_1;Name_1;FromBreak_1;ToBreak_1")
arcpy.DeleteField_management(IntersectBoucle,DropField)
outputPolygons1 = "C:\Temp\Zone_Support_mutuel_test\Test_temp\ServiceAreaV2\Intersect" + "\\" + "Intersect" + str(j)
# Variable de la boucle
# Loop Variable
k = 1
fclistBoucle = fclist[k]
# Debut de la boucle
# Loop start
#for i in range(len(fclist)):
for i in range(len(fclist)):
#if k < 9 :
looptime = time.asctime()
print looptime
print i
print fclistBoucle
print str(IntersectBoucle)
# Intersection
arcpy.Intersect_analysis([IntersectBoucle,fclistBoucle],OutIntersectBoucle)
print "#### " + str(k) + "ieme intersection(Boucle) ###########"
fieldnames4 = [f.name for f in arcpy.ListFields(OutIntersectBoucle)]
print fieldnames4
# Peupler les champs isSame, Supported and Supporting
# Populate field isSame, Supported and Supporting
arcpy.CalculateField_management(OutIntersectBoucle,"isSame","isSame( !Name!, !Name_1! )","Python_9.3",codeblock)
arcpy.CalculateField_management(OutIntersectBoucle,"Supported","PeuplerZone ( !isSame!, !Name!)","Python_9.3",codeblock2)
arcpy.CalculateField_management(OutIntersectBoucle,"Supporting","PeuplerZone ( !isSame!, !Name_1!)","Python_9.3",codeblock3)
j += 1
# Extraire les enregistrements qui respectent les conditions pour les zones soutenues et supportées
# Extract feature that meets requirements for Supporting and Supported zones
arcpy.CopyFeatures_management(OutIntersectBoucle, outputPolygons1)
# Extract feature that doesn't meets requirements and needs to be Intersect again
arcpy.MakeFeatureLayer_management(OutIntersectBoucle,IntersectBoucle,isSameQuery)
arcpy.DeleteField_management(IntersectBoucle,DropField)
outputPolygons1 = "C:\Temp\Zone_Support_mutuel_test\Test_temp\ServiceAreaV2\Intersect" + "\\" + "Intersect" + str(j)
#k += 1
#fclistBoucle = fclist[k]
OutIntersectBoucle = "in_memory" + "\\" + "OutIntersect" + str(j)
k += 1
fclistBoucle = fclist[k]
#if k >9:
#break
print "L'opération d'intersection est complétée"Code:
ERROR: PYTHON ERRORS:
Traceback info:
File "C:\Documents and Settings\uboiv8z\workspace\Network_Analyst\src\Zone_Support_Mutuel\ZSM_Elevation_V8_Intersect_exportV8-1.py", line 122, in <module>
fclistBoucle = fclist[k]
Error Info:
list index out of range
ERROR: ArcPy ERRORS:
WARNING 000728: Field FID_Global,FacilityID_1 does not exist within table