Select to view content in your preferred language

arcpy.Copy_management is throwing a runtime error

1679
5
07-03-2019 05:30 PM
MayKao1
Occasional Contributor

I want to copy a table from SDE to a local file gdb.

Assuming

  SDEworkspace is the full path to the SDE database

  outGDB is the full path to the local file gdb

Here is the code:

   arcpy.env.workspace = SEDworkspace

   tableName = "MasterStreetName"

   outTableName = "{}\{}".format(outGDB, tableName)

   arcpy.Copy_management(tableName, outTableName)

Runtime error  Traceback (most recent call last):   File "<string>", line 1, in <module>   File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\management.py", line 4314, in Copy     raise e ExecuteError: ERROR 000840: The value is not a Data Element. 

This script used to work and other features are copied correctly, just seem to have problem with tables.

Tags (2)
0 Kudos
5 Replies
LanceCole
MVP Regular Contributor

May, 

One notable item is a possible typo in your script, "arcpy.env.workspace = SEDworkspace" may need to be "SDEworkspace".  Or is this just a typo in your post?

0 Kudos
MayKao1
Occasional Contributor

It's just a typo in the post.

0 Kudos
NeilAyres
MVP Alum

What do you mean by this :

SDEworkspace is the full path to the SDE database

The variable SDEworkspace should contain a full path and name of a sde connection file.

0 Kudos
MayKao1
Occasional Contributor

It has the full path name of a sde connection file.

I just posted pseudo code.

0 Kudos
LanceCole
MVP Regular Contributor

May, 

1) Does the error message listed correspond to your sudo code?  In particular the File “<string>”, line 1 relate to the arcpy.env.workspace = SDEworkspace line 1 in your sudo code.

Here is the code:

   arcpy.env.workspace = SEDworkspace

   tableName = "MasterStreetName"

   outTableName = "{}\{}".format(outGDB, tableName)

   arcpy.Copy

 

Runtime error  Traceback (most recent call last):   File "<string>", line 1, in <module>   File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\management.py", line 4314, in Copy     raise e ExecuteError: ERROR 000840: The value is not a Data Element.

2) is this running as a stand-alone script or in ArcGIS.  I have seen this error when coping a feature when it is active in the TOC from desktop scripts.

0 Kudos