arcpy.Copy_management is throwing a runtime error

510
5
07-03-2019 05:30 PM
Highlighted
New Contributor III

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)
Reply
0 Kudos
5 Replies
Highlighted
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?

Reply
0 Kudos
Highlighted
New Contributor III

It's just a typo in the post.

Reply
0 Kudos
Highlighted
MVP Frequent Contributor

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.

Reply
0 Kudos
Highlighted
New Contributor III

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

I just posted pseudo code.

Reply
0 Kudos
Highlighted
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.

Reply
0 Kudos