Geoprocessing Service Output File scratch directory path to url

08-05-2013 11:12 PM
New Contributor III

I'm making a geoprocessing service that returns a .pdf file

As I saw in some examples I used the scratchFolder :
outputFile = os.path.join(arcpy.env.scratchFolder, myPDFFile)
arcpy.SetParameterAsText(7, outputFile)

Once published on the server, the file is recorded here :

When I use the geoprocessingService it returns an 'url' :



Here is my problem :
I'd like to return more than just a file. I'd like to return an object that contains my file directory and other pieces of information.
def packResultsToJson(result):

    # -- result looks like :
    # result={}
    # result['succeed']=True
    # result['url']=myPDFFile
    # result['failedLayers']=failedServices
    # result['error']="NoError"
    # result['timeElapsed'] = str(time.time() - start_time) + " seconds"

    arcpy.SetParameterAsText(7, result)

In this case, my pdf directory is inside an object. Once published on the server, the physical windows path is no longer converted as a server 'url' (so the client receives : 'D:\arcgisserver\directories\arcgisjobs\myGeoprocessing\j8ba6feb42bce4586971ad1abc33aac81\scratch\myPDFFILE.pdf')

Is it possible to explicitly call the function that convert the physical windows path to an url ?
If this is not possible, is there a better way to achieve what I'm trying to do ?
0 Kudos
1 Reply
New Contributor

I know this post is very old, but did you ever find a solution for this? A coworker and I are currently having exactly the same problem. Thanks!

0 Kudos