Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My end goal is to get an excel (I'll probably just settle for .csv) file loaded from a silverlight app into my "%SCRATCHWORKSPACE%" for my gp service. I will be linear referencing the data onto a polyline.

I have silverlight reading the csv file's contents and packing it into a string to send over to ArcGIS Server.

Then I want to write this data to a csv file in the "%SCRATCHWORKSPACE%". But I don't seem to be able to use any standard python code to hit the "%SCRATCHWORKSPACE%".

Any thoughts or critiques?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

arcpy.env.scratchWorkspace yields

C:\Users\ARCGIS~\AppData\Local\Temp\geoprocessing\model_gpserver\j7560bf9fcf9844f7a4736d36ea123456\scratch

Which allowed my to use non-arcpy methods targeting the scratch workspace of a gp service job request.

share|improve this answer
add comment

Set an input to your gp service to be the %scratchworkspace% - this should get resolved by ArcGIS Server into a actual directory path on disk that (assuming the SOC account has access to the folders) you should be able to write to no worries. It will end up in the arcgisjobs folder, in a subfolder under the name of the service, and then under another subfolder that is created by ArcGIS Server on a random text string. e.g.:

C:\arcgisserver\arcgisjobs\toolbox\model\j5f4eb1370ded4e8e99a17519c0989850

Last tip is that this doesn't get cleaned up automatically, so you'll have to set that up yourself.

Hope this helps!

share|improve this answer
    
I have no issues writing to the the job folder j5f4eb1370ded4e8e99a17519c0989850\scratch\ folder with arcpy methods but I can't do os.rename(src,dst). I get an error saying the directory is not found. –  Justin Apr 18 '12 at 12:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.