Select to view content in your preferred language

Python script tool converts "Data File" output type to GPString

847
1
Jump to solution
03-19-2018 09:04 AM
PeterLen
Frequent Contributor

I am using ArcGIS 10.4.  I have a Python script tool where my tool's output type is set to "Data File" when I add it to a toolbox.  When I publish it and I look at the tool's service endpont, I see that  the output data type is set to GPString.  When I run the tool from the endpoint via Submit Job, the tool runs fine but the output value is blank.  As a test, I changed the output data type to String in the toolbox and then re-published the tool.  As expected, the output data type is listed as GPString at the service endpoint .  When I run the tool via Submit Job, the output value is a file system path to the data file (a ZIP file).  Not sure why when I define the output data type as a "Data File", that it changes it to GPString after publishing and then does not contain the expected value when the tool is run as GP Service.  The goal in this is actually have a derived URL to that output file be sent as the output.  That is what happens when using a Python Toolbox (.pyt) and setting the output parameter to "GPDateFile".  When running the tool from the Python Toolbox via ArcCatalog, the output is simply the system file path, but when the tool is run via the GP Service, the output is converted by ArcGIS to a URL to the file.  Due to other issues with publishing my Python Toolbox, I needed to publish the same tool as a script tool that I added to a toolbox.  I expected the results to be the same, but for some reason they are not the same.  I am not sure if the output value is empty in the case of the "Data File" output type of the script tool because ArcGIS has some issue with generating a valid URL.  Does anyone have any insight into what may be happening?  Thanks - Peter

0 Kudos
1 Solution

Accepted Solutions
PeterLen
Frequent Contributor

UPDATE... found that if I changed the script tool's output parameter's data type from "DATA FILE" to "FILE", all works as expected.  Why a FILE data type is set to a GPDataFile type for the GP service but a "DATA FILE" type is set to a GPString is not very intuitive.  Pretty consfusing.

View solution in original post

1 Reply
PeterLen
Frequent Contributor

UPDATE... found that if I changed the script tool's output parameter's data type from "DATA FILE" to "FILE", all works as expected.  Why a FILE data type is set to a GPDataFile type for the GP service but a "DATA FILE" type is set to a GPString is not very intuitive.  Pretty consfusing.