I came across this post and found out about Copy_management().

Is it possible to copy an in_memory feature to another in_memory feature?

I tried to test it using the following code, which fails:

shp = r"D:\test\somefile.shp"

bufferOne = arcpy.Buffer_analysis(shp,r"in_memory\bufferOne",'1 meters')

copyOfFirst = arcpy.Copy_management(bufferOne,r'in_memory\BufferOneCopy')

Trying the exact same thing with absolute paths, instead of in_memory works fine. Therefore I assume you cannot copy from in_memory to in_memory, or am I missing something? Would there be a way to achieve the same effect?

  • What do you mean by "fails"? Did you get an ERROR 000260 or something else? – PolyGeo Aug 25 '15 at 9:18

It is not possible to save the output of the Copy tool to in_memory, whatever the input's workspace. It is explained in the last answer of the post you mentioned, I add here an updated reference.

FYI, there are some other tools that don't accept in_memory as output workspace, e.g. Project.

  • 2
    I agree - Copy_management can only be used between workspaces of the same type. Otherwise an ERROR 000260 will result. – PolyGeo Aug 25 '15 at 9:16

Yes, you can. Use the Copy_Features GP tool for that.

pnt_fc = r"C:\Users\us\Documents\ArcGIS\Default.gdb\_PointDistanceFc"

mem1 = r"in_memory\bufferOne"
mem2 = r"in_memory\bufferTwo"

                      buffer_distance_or_field='10 Meters')



When you use the following approach:

mem1 = arcpy.Buffer_analysis(in_features=pnt_fc,
                      buffer_distance_or_field='10 Meters')

mem2 = arcpy.CopyFeatures_management(mem1,r"in_memory\bufferTwo")


You are getting mem1 and mem2 of type <class 'arcpy.arcobjects.arcobjects.Result'>, you should be aware of this if you are planning to interact with those objects.

  • It's Copy_management not CopyFeatures_management being used. – PolyGeo Aug 25 '15 at 9:15
  • True, but the question was "My question is if it is possible to copy an in_memory feature to another in_memory feature." – Alex Tereshenkov Aug 25 '15 at 9:16
  • You're right - I was distracted by the title which did not fully summarize the content. – PolyGeo Aug 25 '15 at 9:19
  • The reason I ended up working with Copy_management is because CopyFeatures_management always spits out an error message for me when trying to save into memory, so I assumed it cannot be used to save into memory. I will have to try your code snippet later, and I will let you know. – BritishSteel Aug 25 '15 at 13:19

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.