2

I am doing a basic copy from sde database to file geodatabase. I have a loop going through each feature dataset in the sde database, this loop is really basic it just uses arcpy.Copy_Management to copy everything over. I have arcpy.env.overwriteOutput = True at the beginning of the script after importing in arcpy. It does not throw me that error for any other feature dataset, even though they are also overwriting a FeatureDataset with the same name.

the error it throws is :

ERROR 000605: Output Sidewalk already exists within C:\Users\stack\Desktop\Testing\scripts\Dump.gdb\Sidewalk. Failed to execute (Copy).

I even added arcpy.env.overwriteOutput = True to the beginning to of the function. I also put a line in the exception the prints out the status of env.overwriteOutput and it is true at that time when it breaks.

This does not make any sense to me. Has anyone else had this problem?

  • In python true is a variable, True is the builtin constant. Not sure if that's a typo on your part. – Paul Aug 13 '15 at 17:34
  • Yeah sorry thats a typo on my part. I have it True on my actual script – Sharm Aug 13 '15 at 17:36
  • Are you using from arcpy import env? If not, you need to use the full arcpy.env.overwriteOutput. – Paul Aug 13 '15 at 17:38
  • Sorry I just forgot to add that part in. Yes im using arcpy.env.overwriteOutput its weird because this is the only dataset that is giving me this. All the other ones are also overwriting and they are perfectly fine overwriting – Sharm Aug 13 '15 at 17:43
  • 2
    That method works just as well: if arcpy.Exists (fc): arcpy.Delete_management (fc) – Emil Brundage Aug 13 '15 at 21:00
3

As discussed in the comments, this appears to be a bug of some sort. Use the workaround Exists \ Delete method:

if arcpy.Exists (fc): 
    arcpy.Delete_management (fc)
  • Yeah thats what I have been doing, thanks for submitting it as an answer for others though. – Sharm Aug 19 '15 at 12:16
2

I know this is very old, but I thought I'd add another solution that I figured out after coming across the same error just now, as it may help others that look here in future.

Make sure that feature class is not in use anywhere else.

In my case I had set arcpy.env.overwriteOutput = True but got the error ExecuteError: ERROR 000258: Output C:\blah\blah\blah already exists while that feature class was being displayed in ArcMap. I then closed ArcMap, and ran the script again (in PyScripter) and the script worked fine with no errors.

NB: ArcMap is very bad at hanging on to things it no longer needs. In some cases removing a layer in ArcMap, or even opening a new blank map may not be enough. You may have to actually close ArcMap completely.

Also, make sure the feature class is not being used by any other processes. Eg, ArcCatalog, ArcGIS Server (eg in a map service), some other Python script, etc, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.