Select to view content in your preferred language

Calling arcpy.analysis.SumamrizeWithin() multiple times

123
3
Jump to solution
Wednesday
BenMoir
New Contributor

New to the forum. I want to use arcpy.analysis.SumamrizeWithin() in a for loop to determine which polygons a certain polyine is contained within. I will repeat for each polyline in the feature class "shp". "street10m" is a polygon file.

I have found that arcpy.analysis.SumamrizeWithin() fails on every SECOND attempt within a code. The first time works fine. here is my sample script: 

 

print(10)
arcpy.conversion.FeatureClassToFeatureClass(shp,gdb,"zshp1","OBJECTID = 10")
print(11)
arcpy.conversion.FeatureClassToFeatureClass(shp,gdb,"zshp2","OBJECTID = 11")
print(12)
arcpy.conversion.FeatureClassToFeatureClass(shp,gdb,"zshp3","OBJECTID = 12")
print(13)
arcpy.analysis.SummarizeWithin("street10m","zshp1","z1")
print(14)
arcpy.analysis.SummarizeWithin("street10m","zshp1","z2")
print(15)
arcpy.analysis.SummarizeWithin("street10m","zshp1","z3")
print(16)

 

As written, the line to make "z2" will fail, even though its equivalent to the line which makes "z1". However, if I comment out the line which makes "z1", then "z2" is made successfully and "z3" fails. Error code 100014. If I create z1,z2,z3 manually as a batch, it also succeeds.

What is causing this behaviour? How can I allow SummarizeWithin() to be used more than once in the same arcpy script?

ArcGIS Pro 3.3 and ArcPy 3.11.8.

0 Kudos
1 Solution

Accepted Solutions
BenMoir
New Contributor

Update: Adding this line to the top of the ArcPy script fixed the issue. Something to do with Schema Locks maybe? I am not really sure why it worked, but it did.

arcpy.env.overwriteOutput = True

View solution in original post

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

There is this article on the support site

Error: 100014: Summarize within Failed

and this error, amongst several

BUG-000172797 for ArcGIS Pro

and this post which I replied to

Arcpy Summarize Within fails after one iteration w... - Esri Community

which suggests that file locking may be at issue, but the post wasn't resolved

So perhaps check your paths, pre-process your inputs and try again after a restart


... sort of retired...
0 Kudos
BenMoir
New Contributor

Thank you, Dan, I have seen the support site article, which you also shared on a number of other threads. Thanks. Path length and naming cannot possibly be the issue here, as both lines of code have the same number and type of characters. 


I have not seen the  BUG-000172797 yet, but it relates to an option I am not using.

Any other ideas?

0 Kudos
BenMoir
New Contributor

Update: Adding this line to the top of the ArcPy script fixed the issue. Something to do with Schema Locks maybe? I am not really sure why it worked, but it did.

arcpy.env.overwriteOutput = True

0 Kudos