Python Pro does not allow to truncate a feature class

182
1
4 weeks ago
Labels (1)
SanchezNuñez
Occasional Contributor

Good afternoon,

We converted a Python script from ArcGIS 10.7.1  to Python Pro.  Now when we try to truncate a feature class we get the following error message:

Python Error occurred
ERROR 160592: Truncation not allowed while editing.
Truncation not allowed while editing.
Failed to execute (TruncateTable).

It looks like Python Pro does not behave the same way as Python ArcGIS 10.7.

How can we fix this error?

Thanks

 

 

0 Kudos
1 Reply
AlfredBaldenweck
MVP Regular Contributor

The answer would be to stop editing, but without your code, the specifics are unclear here.

If you were manually editing the table before, save or discard those edits and try again.

Elsewise, if you have an editor object Editor—ArcGIS Pro | Documentation, try removing it or placing the truncate outside of the edit loop if structured as

with arcpy.da.Editor(workspace) as edit:

If neither of these work, post your code and we can figure it out.

 

0 Kudos