<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem Deleting scratchGDB after script runs in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390436#M30851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Isn't the scratch.gdb designed to *always* be available and *guaranteed* to exist?&amp;nbsp; If so, why attempt to delete it (if that's even possible)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the suggested "clean up" is not saying to delete the .gdb or the workspace.&amp;nbsp; Rather it is saying, delete the contents of the .gbd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000006w000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000006w000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
inFC = arcpy.GetParameterAsText(0)

tempFC = arcpy.env.scratchGDB + os.path.sep + "tempFC"
arcpy.CopyFeatures_management(inFC, tempFC)

# Do some work here...

# Clean up when done...
#
arcpy.Delete_management(&lt;STRONG&gt;tempFC&lt;/STRONG&gt;)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not use the "in_memory" workspace instead?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:54:27 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-11T17:54:27Z</dc:date>
    <item>
      <title>Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390431#M30846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a script running that does a bit of spatial analysis, creates a relationship table and exports layout images to JPEG for report.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It runs great, but I am having a problem doing proper cleanup. I go to delete the scratchGDB using arcpy.delete, and it works fine. The problem is that a leftover scratch.gdb remains in the workspace directory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After running arcpy.delete the leftover scratch.gdb is not a true geodatabase; in ArcCatalog it appears as a folder with a plus to the left of it. Drilling down on the plus and there is nothing in there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also added a line to delete that file in python and I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[Error 5] Access is denied: 'D:\\gis\\Data\\scratch.gdb'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sometimes the script works fine without deleting the scratch.gdb (it simply overwrites), other times it tells me it cannot create the initial output and fails. I would appreciate any help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 13:22:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390431#M30846</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2014-02-27T13:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390432#M30847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This should work through arcpy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if arcpy.Exists(r"D:\gis\Data\scratch.gdb"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(r"D:\gis\Data\scratch.gdb")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that's not working, you could try to do it through straight Python instead.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import shutil, os

# This will remove the entire folder, plus any subfolders
if os.path.isdir(r"D:\gis\Data\scratch.gdb"):
&amp;nbsp;&amp;nbsp;&amp;nbsp; shutil.rmtree(r"D:\gis\Data\scratch.gdb")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Usually the Arcpy way is preferred though since ArcMap is fond of it's file locks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:54:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390432#M30847</guid>
      <dc:creator>MattEiben</dc:creator>
      <dc:date>2021-12-11T17:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390433#M30848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your reply. However the problem is not a lock or getting things to work. The arcpy.delete function works, and it deletes all feature inside the gdb, and the gdb too. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is there is a leftover folder called scratch where the file geodatabase scratch.gdb used to be. Inside the folder is another folder called "info", and inside of "info" is arc.dir&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is causing the script to fail on the next pass. Since it is running daily via task scheduler, it is not working. This is not acceptable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why is the esri delete function not removing the scratch geodatabase? It is better to not delete at all, then at least the scratch geodatabase and features inside are overwritten.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems the arcpy.delete function only serves to corrupt the scratch geodatabase, rendering it useless, instead of actually deleting it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Feb 2014 18:08:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390433#M30848</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2014-02-27T18:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390434#M30849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perhaps try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.Delete_management(arcpy.env.scratchGDB)
arcpy.Delete_management(arcpy.env.scratchFolder)
arcpy.Delete_management(arcpy.env.scratchWorkspace)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This should delete the folders as defined in the user's environmental variables. arcpy.env.scratchGDB and scratchFolder exist within the scratchWorkspace (or the parent folder if the scratchWorkspace is a gdb)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also these methods return a variable which should be 'true' (string) if the operation was successful for additional checking if necessary.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:54:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390434#M30849</guid>
      <dc:creator>ClintDow</dc:creator>
      <dc:date>2021-12-11T17:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390435#M30850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Perhaps try:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.Delete_management(arcpy.env.scratchGDB)
arcpy.Delete_management(arcpy.env.scratchFolder)
arcpy.Delete_management(arcpy.env.scratchWorkspace)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This should delete the folders as defined in the user's environmental variables. arcpy.env.scratchGDB and scratchFolder exist within the scratchWorkspace (or the parent folder if the scratchWorkspace is a gdb)&lt;BR /&gt;&lt;BR /&gt;Also these methods return a variable which should be 'true' (string) if the operation was successful for additional checking if necessary.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the suggestion. I added these lines, and they "work", but there is still a scratch.gdb folder leftover, and now it has two files inside. Both are "xxxx.sr.lock"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anybody from esri care to comment? I feel like this should be so easy...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390435#M30850</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2021-12-11T17:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390436#M30851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Isn't the scratch.gdb designed to *always* be available and *guaranteed* to exist?&amp;nbsp; If so, why attempt to delete it (if that's even possible)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the suggested "clean up" is not saying to delete the .gdb or the workspace.&amp;nbsp; Rather it is saying, delete the contents of the .gbd:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000006w000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000006w000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
inFC = arcpy.GetParameterAsText(0)

tempFC = arcpy.env.scratchGDB + os.path.sep + "tempFC"
arcpy.CopyFeatures_management(inFC, tempFC)

# Do some work here...

# Clean up when done...
#
arcpy.Delete_management(&lt;STRONG&gt;tempFC&lt;/STRONG&gt;)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not use the "in_memory" workspace instead?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:54:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390436#M30851</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T17:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390437#M30852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's also another similar thread on this topic from yesterday too:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/103648-Scratch-Workspace"&gt;http://forums.arcgis.com/threads/103648-Scratch-Workspace&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some good info in there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 12:03:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390437#M30852</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-02-28T12:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390438#M30853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Isn't the scratch.gdb designed to *always* be available and *guaranteed* to exist?&amp;nbsp; If so, why attempt to delete it (if that's even possible)?&lt;BR /&gt;&lt;BR /&gt;Edit:&lt;BR /&gt;&lt;BR /&gt;Also, the suggested "clean up" is not saying to delete the .gdb or the workspace.&amp;nbsp; Rather it is saying, delete the contents of the .gbd:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000006w000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000006w000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

import arcpy
import os
inFC = arcpy.GetParameterAsText(0)

tempFC = arcpy.env.scratchGDB + os.path.sep + "tempFC"
arcpy.CopyFeatures_management(inFC, tempFC)

# Do some work here...

# Clean up when done...
#
arcpy.Delete_management(&lt;STRONG&gt;tempFC&lt;/STRONG&gt;)

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Why not use the "in_memory" workspace instead?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had actually thought of using in memory workspace, but was not sure if you can use it with a map document. Part of my script uses a detailed layout saved in an .mxd in the same folder the script runs with the layers pointed into the scratchGDB for jpeg exports.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll try just deleting the feature classes out of the scratch gdb. I would feel more comfortable if the gdb was completely deleted however as "schema locks" seem to always come back to haunt me.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:54:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390438#M30853</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2021-12-11T17:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390439#M30854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get what the OP is getting at. I had the same issue. Except that I was creating script/tool that left a file geodatabase as its result. I need to have the tool test to see if this resulting file geodatabase already exists before it creates it. If it exists, it will delete it and create an empty one before proceeding into the guts of the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus, the expected code was:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gdb_dir = r"C:\Temp"
gdb_name = "result_gdb.gdb"
gdb_path = r"C:\Temp\result_gdb.gdb"
if arcpy.Exists(gdb_path):
&amp;nbsp; arcpy.Delete_management(gdb_path)
arcpy.CreateFileGDB_management(gdb_dir,gdb_name)
&lt;STRONG&gt;arcpy.CreateFeatureclass_management(gdb_path,"myPolys","POLYGON")&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Except that, like the OP, when I step through this in the debugger, right after the "Delete_management" call, I notice that a file directory with the same name as the file geodatabase still exists. Thus, if this non-gdb file directory exists, the Exists() function call returns a &amp;lt;True&amp;gt; value and the code would end up calling the Delete_management function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I discovered that the following code produces curious (surprising, unexpected) results:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gdb_dir = r"C:\Temp"
gdb_name = "result_gdb.gdb"
gdb_path = r"C:\Temp\result_gdb.gdb"
arcpy.CreateFileGDB_management(gdb_dir,gdb_name)
arcpy.CreateFeatureclass_management(gdb_path,"myPolys","POLYGON")
arcpy.Describe(gdb_path).workspaceType
# returns u'LocalDatabase'
arcpy.Delete_management(gdb_path) # the first call to Delete
arcpy.Exists(gdb_path)
# returns True
arcpy.Describe(gdb_path).workspaceType
# returns u'FileSystem' # the type has changed
arcpy.Delete_management(gdb_path) # the second call to Delete
arcpy.Exists(gdb_path)
# returns False # now it returns false&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, now the python code might have to check just how much the target file geodatabase has been deleted.&lt;/P&gt;&lt;P&gt;I don't want to enable overwriting for the script. I'm not using a 'scratch' workspace. It's not an 'in_memory' usage. I just expect that when I call a function to Delete something that that thing is actually deleted, not just turned into a different type of object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, now the code is:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;while arcpy.Exists(gdb_path):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(gdb_path)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # just keep calling Delete until it finally goes away&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390439#M30854</guid>
      <dc:creator>GeorgeRiner</dc:creator>
      <dc:date>2021-12-11T17:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390440#M30855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this while loop.... And it's still while-ing, several minutes later. Does this approach actually work, or is this an infinite loop?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 18:55:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390440#M30855</guid>
      <dc:creator>PriscillaCole</dc:creator>
      <dc:date>2016-05-27T18:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390441#M30856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmmmm, I suspect it will stop when you reboot... never while something that you aren't sure is going to finish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 18:57:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390441#M30856</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-27T18:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Deleting scratchGDB after script runs</title>
      <link>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390442#M30857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Did you try turning it off and on again?" -IT Crowd&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was also having this problem. arcpy.Delete_management(GDB_path) would not remove my GDB, and left a weird folder behind. I attempted the while-loop approach (mentioned above), but that turned out to be an infinite loop, and I had to kill ArcMap to stop it.&amp;nbsp; When I restarted ArcMap, the GDB hadn't been deleted. For fun, I tried running the original command again: arcpy.Delete_management(GDB_path). And it worked! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Restart to the rescue again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 May 2016 20:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-deleting-scratchgdb-after-script-runs/m-p/390442#M30857</guid>
      <dc:creator>PriscillaCole</dc:creator>
      <dc:date>2016-05-27T20:01:17Z</dc:date>
    </item>
  </channel>
</rss>

