<?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: How to Properly Use env.scratchGDB to Gaurantee Write Access in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654931#M50998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like you just need to include a path seperator (i.e. "\\")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So instead of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lclImplsblRd = env.scratchGDB + "SAP_IMPLAUSIBLE_READS"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;use one of these:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lclImplsblRd = env.scratchGDB + "\\SAP_IMPLAUSIBLE_READS"
lclImplsblRd = os.path.join(env.scratchGDB, "SAP_IMPLAUSIBLE_READS")
lclImplsblRd = env.scratchGDB + os.path.sep + "SAP_IMPLAUSIBLE_READS"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:44:51 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2021-12-12T03:44:51Z</dc:date>
    <item>
      <title>How to Properly Use env.scratchGDB to Gaurantee Write Access</title>
      <link>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654930#M50997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In scripting business processes it is coming up again and again where I need an intermediate workspace to write data. I am trying to copy a table to the scratch workspace but it is placing the table into a dbf in the folder where the scratchGDB is located. Here is what I have:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy, arceditor, logging, datetime, os, smtplib
from arcpy import env
arcpy.env.overwriteOutput = True
InputPrefix = "Database Connections\\Sun130 - 5151.sde\\"
tblImplsblRd = InputPrefix + "GIS_INTERFACE.SAP_IMPLAUSIBLE_READS"
lclImplsblRd = env.scratchGDB + "SAP_IMPLAUSIBLE_READS"

def copyRows(src, trgt, cfg):
&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyRows_management(src, trgt, cfg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.info(": Copied %s to %s" %(src, trgt))

&amp;nbsp;&amp;nbsp;&amp;nbsp; except Exception as e:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print e
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.error(": %s" %(e))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgTxtErr = msgTxtErr + "\n" + "* " + str(e)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; errValue = 1

copyRows(tblImplsblRd, lclImplsblRd, "")

print "done"
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run this from a script exported from ModelBuilder it places the table into the temporary gdb:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# temp.py
# Created on: 2013-04-29 10:29:12.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy


# Local variables:
GIS_INTERFACE_SAP_IMPLAUSIBLE_READS = "Database Connections\\Sun130 - 5151.sde\\GIS_INTERFACE.SAP_IMPLAUSIBLE_READS"
SAP_IMPLAUSIBLE_READS = "C:\\Users\\TDMC0\\AppData\\Local\\Temp\\scratch.gdb\\SAP_IMPLAUSIBLE_READS"

# Process: Copy Rows
arcpy.CopyRows_management(GIS_INTERFACE_SAP_IMPLAUSIBLE_READS, SAP_IMPLAUSIBLE_READS, "")

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However if the path to the scratch GDB is hard-coded I will lose the ability to have a gauranteed space to write data. Would appreciate help getting this working correctly.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2013 13:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654930#M50997</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-04-29T13:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Properly Use env.scratchGDB to Gaurantee Write Access</title>
      <link>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654931#M50998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like you just need to include a path seperator (i.e. "\\")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So instead of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lclImplsblRd = env.scratchGDB + "SAP_IMPLAUSIBLE_READS"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;use one of these:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;lclImplsblRd = env.scratchGDB + "\\SAP_IMPLAUSIBLE_READS"
lclImplsblRd = os.path.join(env.scratchGDB, "SAP_IMPLAUSIBLE_READS")
lclImplsblRd = env.scratchGDB + os.path.sep + "SAP_IMPLAUSIBLE_READS"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654931#M50998</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-12T03:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Properly Use env.scratchGDB to Gaurantee Write Access</title>
      <link>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654932#M50999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;BTW: You might find the "in_memory" workspace another (maybe better) option for what you need&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000005s000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000005s000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2013 15:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654932#M50999</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-04-29T15:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Properly Use env.scratchGDB to Gaurantee Write Access</title>
      <link>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654933#M51000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks I added the "\\" but am still getting errors due to schema locks. I was under the impression that could not happen (hence the whole point of the scratchGDB environment). If there is something else I am doing wrong please let me know.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will implement the in-memory workspace after testing is complete but in the development stage I need to see the intermediate tables structures.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2013 15:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654933#M51000</guid>
      <dc:creator>MarcCusumano</dc:creator>
      <dc:date>2013-04-29T15:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to Properly Use env.scratchGDB to Gaurantee Write Access</title>
      <link>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654934#M51001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;schema locks&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="text-decoration:underline;"&gt;Surefire way to clear schema locks:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are or ever have looked at the contents of the scratch workspace with your current ArcMap session, close ArcMap and reopen it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are or ever have looked at the contents of the scratch workspace with your current ArcCatalog session, browse to another workspace/directory and hit F5.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you are or ever have looked at the contents of the scratch workspace with Python via arcpy, close your Python IDE, and reopen it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Apr 2013 16:00:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-properly-use-env-scratchgdb-to-gaurantee/m-p/654934#M51001</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2013-04-29T16:00:58Z</dc:date>
    </item>
  </channel>
</rss>

