I'm trying to have a new GP Service arcpy.AddMessage() the scratchworkspace that is created on that run. I keep getting a invalid syntax error.
But real aim is to write to this scratchworkspace but the %scratchworkspace%/ doesn't seem to be working for me.
line = arcpy.GetParameterAsText(0)
arcpy.AddMessage(line)
try:
arcpy.AddMessage(str(%scratchworkspace%))
except:
arcpy.AddMessage(traceback.format_exc())
This is a gp service published through the arcmap process, I've opened and run the tool layer once already and the Tool is creating the scratchworkspace in arcgisjobs directory
arcgisjobs\geoprocessing\gpservicetest_gpserver\jf93e76ce2f0f4967b7b9028c384b19f8\scratch
So how do I get a hold of this in python to write to?
Thanks.
Best Answer
I think you will need to use arcpy.env.scratchWorkspace instead of %scratchworkspace%.
This blog posting makes mention of %scratchworkspace% only being applicable to ModelBuilder and this Help page provides more details about arcpy.env.scratchWorkspace.