Copy GP Tool used in Python

02-20-2012 10:50 AM
New Contributor II
I am trying to use the Copy GP tool in desktop and in a Python script to copy feature datasets, but cannot get it to work either way.  Very frustrating!  What's the quirk here?  If I select a feature dataset in a file GDB in catalog and click copy, and then past it into another file gdb, all works fine.  This is what I want to do.  But, I need to script this process, thus need to use the GP tool Copy.  I'm trying umpteen things, just not getting there at all.  It might work once, but then to repeat it is impossible.  Is there a better way to do?  Any help would be greatly appreciated!!

v10 sp3

import arcpy, os

inFDS = "C:\\Temp\\testing.gdb\\sunday"
outFDS = "C:\\Temp\\testing_copied2.gdb\\sunday"

# Declare workspaces
inWorkspace = os.path.dirname(inFDS)
outWorkspace = os.path.dirname(outFDS)

arcpy.env.workspace = inWorkspace
arcpy.Copy_management(inFDS, outFDS, "FeatureDataset")

error messages are not helpful, maybe this one, but...
"While using the Copy tool, the input could not be successfully copied to its new location. This error typically occurs while copying data from one location to another.

The "in_memory" workspace is not supported as the output location."
0 Kudos
1 Reply
MVP Notable Contributor

I tried this code (note I do not set a workspace) and it copied the featuredataset and the featureclasses within it without error.

import arcpy
i = r'C:\Scratch\fGDB_Scratch.gdb\test' 
o = r'C:\Scratch\fGDB_AIS_Cleaned.gdb\test'

0 Kudos