<?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 scratchWorkspace not found when accessing via GPServer process in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/scratchworkspace-not-found-when-accessing-via/m-p/653762#M50919</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using ArcGIS 10.2.2.&amp;nbsp; I ran into an odd problem.&amp;nbsp; I have a Python script which I am using as the script tool for a Geoprocessing service.&amp;nbsp; In the script, I want to set the scratchWorkspace.&amp;nbsp; It might look something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.scratchWorkspace = r"C:\tmp\scratch.gdb"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the tool via the ArcToolbox, all is well in that the script recognizes where the new scratchWorkspace is located.&amp;nbsp; When I call the tool via the GPServer process from a web client, however, I get the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tool or environment &amp;lt;scratchWorkspace&amp;gt; not found&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is thrown the first time I try to access the arcpy.env.scratchWorkspace after it was set.&amp;nbsp; I ran a test where I printed each environment variable from arcpy.&amp;nbsp; If I didn't set the scratchWorkspace, the GPServer would not throw an error and would list the scratchWorkspace in the current arcgisjobs area.&amp;nbsp; If I set the scratchWorkspace and then list all of the environment variables and their values, it would list the environment variable "scratchWorkspace" but would throw the error when I tried to retrieve the value.&amp;nbsp; Again, the error was only thrown if I had set the scratchWorkspace to some value.&amp;nbsp; I tried to see if the same thing would happen when setting the "workspace" variable but no error was thrown with that one.&amp;nbsp; Just with the scratchWorkspace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems very odd.&amp;nbsp; Any clues as to why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks - Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Apr 2015 17:32:06 GMT</pubDate>
    <dc:creator>PeterLen</dc:creator>
    <dc:date>2015-04-23T17:32:06Z</dc:date>
    <item>
      <title>scratchWorkspace not found when accessing via GPServer process</title>
      <link>https://community.esri.com/t5/python-questions/scratchworkspace-not-found-when-accessing-via/m-p/653762#M50919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using ArcGIS 10.2.2.&amp;nbsp; I ran into an odd problem.&amp;nbsp; I have a Python script which I am using as the script tool for a Geoprocessing service.&amp;nbsp; In the script, I want to set the scratchWorkspace.&amp;nbsp; It might look something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.scratchWorkspace = r"C:\tmp\scratch.gdb"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run the tool via the ArcToolbox, all is well in that the script recognizes where the new scratchWorkspace is located.&amp;nbsp; When I call the tool via the GPServer process from a web client, however, I get the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tool or environment &amp;lt;scratchWorkspace&amp;gt; not found&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is thrown the first time I try to access the arcpy.env.scratchWorkspace after it was set.&amp;nbsp; I ran a test where I printed each environment variable from arcpy.&amp;nbsp; If I didn't set the scratchWorkspace, the GPServer would not throw an error and would list the scratchWorkspace in the current arcgisjobs area.&amp;nbsp; If I set the scratchWorkspace and then list all of the environment variables and their values, it would list the environment variable "scratchWorkspace" but would throw the error when I tried to retrieve the value.&amp;nbsp; Again, the error was only thrown if I had set the scratchWorkspace to some value.&amp;nbsp; I tried to see if the same thing would happen when setting the "workspace" variable but no error was thrown with that one.&amp;nbsp; Just with the scratchWorkspace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems very odd.&amp;nbsp; Any clues as to why?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks - Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 17:32:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scratchworkspace-not-found-when-accessing-via/m-p/653762#M50919</guid>
      <dc:creator>PeterLen</dc:creator>
      <dc:date>2015-04-23T17:32:06Z</dc:date>
    </item>
  </channel>
</rss>

