Select to view content in your preferred language

Preventing in_memory layer from being removed from table of contect after running Python tool?

05-30-2019 01:08 PM
New Contributor

I am creating a python tool that will be used by multiple people, part of the python tool I am creating I want to run a Statistics_analysis report in_memory.

I don't need to save it (just view it once) and our departments shared folder location has spaces in it name so I couldn't save it here even if I wanted to since you can't save info tables to a path with any spaces.

The tool works perfectly except for the fact the layer just disappear once the tool is complete.

arcpy.Statistics_analysis(r'GROUP\POINTS\GPS Pipe Point', r"in_memory\MN__Table", 'COLLECTIONDATE FIRST;COLLECTIONDATE LAST', 'GPSNUMBER')

0 Kudos
2 Replies
Regular Contributor

Are you running this tool in ArcMap or Pro? I believe once you close out of the program the In_memory is deleted.

Do you have a arcpy.Delete_management("in_memory\MN__Table") at the end of you script?

Your best bet is to write\export the report out then the next time you run the script overwrite it.

0 Kudos
MVP Alum

You could save it to the scratch fgdb.

see the value of env.scratchGDB

0 Kudos