We are using ArcGIS 10.2.2. I ran into an odd problem. I have a Python script which I am using as the script tool for a Geoprocessing service. In the script, I want to set the scratchWorkspace. It might look something like:
arcpy.env.scratchWorkspace = r"C:\tmp\scratch.gdb"
When I run the tool via the ArcToolbox, all is well in that the script recognizes where the new scratchWorkspace is located. When I call the tool via the GPServer process from a web client, however, I get the error:
Tool or environment <scratchWorkspace> not found
The error is thrown the first time I try to access the arcpy.env.scratchWorkspace after it was set. I ran a test where I printed each environment variable from arcpy. If I didn't set the scratchWorkspace, the GPServer would not throw an error and would list the scratchWorkspace in the current arcgisjobs area. 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. Again, the error was only thrown if I had set the scratchWorkspace to some value. I tried to see if the same thing would happen when setting the "workspace" variable but no error was thrown with that one. Just with the scratchWorkspace.
This seems very odd. Any clues as to why?
Thanks - Peter