Select to view content in your preferred language

TruncateTable_management throwing ERROR 000187

4431
1
Jump to solution
11-18-2014 09:16 PM
BenVan_Kesteren1
Regular Contributor

Hi All,

I am playing around in python and am coming stuck with the arcpy.TruncateTable_management tool, as I can run it fine in the python window in Catalog, but when I run my py script it throws the below error:

Executing: TruncateTable "Database Connections\GISADMIN@SDE_Spatial@Smithy.sde\SDE_SPATIAL.GISADMIN.CAD_WSData_Sewer_DEV\Polygon_1"

Start Time: Wed Nov 19 16:07:29 2014

Failed to execute. Parameters are not valid.

ERROR 000187: Only supports Geodatabase tables and feature classes

Failed to execute (TruncateTable).

Failed at Wed Nov 19 16:07:29 2014 (Elapsed Time: 0.03 seconds)

When I run the below line in ArcCatalog it runs fine, no errors, and resultant table is empty as expected:

>>> import arcpy

>>> arcpy.TruncateTable_management(r'Database Connections\GISADMIN@SDE_Spatial@Smithy.sde\SDE_SPATIAL.GISADMIN.CAD_WSData_Sewer_DEV\SDE_SPATIAL.GISADMIN.Polygon1_1')

I find that the error information is not valid as it is able to successfully run within catalog, but not within a py script.

Anyone come across this before? Its rather frustrating.

0 Kudos
1 Solution

Accepted Solutions
BenVan_Kesteren1
Regular Contributor

I have accidentally found the error in my own code, my input feature class name was missing one character, so the script was unable to find the table to truncate.

It seems that I was thrown looking for something else by the error code/decription, when I should have checked the basics first...

I had dragged the feature class into my code when running in ArcCatalog hence why it ran fine within.

Cheers for the views guys.

View solution in original post

0 Kudos
1 Reply
BenVan_Kesteren1
Regular Contributor

I have accidentally found the error in my own code, my input feature class name was missing one character, so the script was unable to find the table to truncate.

It seems that I was thrown looking for something else by the error code/decription, when I should have checked the basics first...

I had dragged the feature class into my code when running in ArcCatalog hence why it ran fine within.

Cheers for the views guys.

0 Kudos