AnsweredAssumed Answered

Geoprocessing service to return a file

Question asked by vteyesriaustralia-com-au-esridist Employee on Jul 21, 2020
Latest reply on Jul 21, 2020 by vteyesriaustralia-com-au-esridist

Hi,

How can I get a geoprocessing service to return a file?

 

I published a GP

 

if __name__ == '__main__':

    file = open(arcpy.env.scratchWorkspace+ "/" + "test.txt","w")
    file.write("why")
    file.close()
    arcpy.SetParameter(0, file.name)

':

however i kept receiving the 

 "value": "d:\\arcgisserver\\directories\\arcgisjobs\\script_gpserver\\j94a7e5b06f3342deb0ebcb65467f63fe\\scratch/test.txt"

I can see the file in the scratch folder but i need to return the file some how.

 

I did try to access the file via different permutation of 

https://example.com/arcgis/rest/services/Script/GPServer/Script/jobs/j94a7e5b06f3342deb0ebcb65467f63fe/scratch/text.txt to no avail

Can someone kindly assist.

Outcomes