Select to view content in your preferred language

Notebook GP tool output parameter has no value

64
0
a week ago
GLIMichael
Emerging Contributor

I have created a simple notebook then published it as a GP tool with 3 output parameters

GLIMichael_0-1754427548378.png

 

Notebook code:

from arcgis.gis import GIS
import os
import json

gis = GIS("home")
token = gis.session.auth.token
op_1 = token
op_2 = len(token)
op_3 = json.dumps({"url":"some url"})

# Inserted snippet writes output parameter file for web tool execution
import os
# Only run this snippet during web tool execution when env variable "ENB_JOBID" will be present
if "ENB_JOBID" in os.environ:
    out_param_name = "op_1"
    out_param_file = os.path.join(
        os.environ["ENB_JOBID"], "value_" + out_param_name + ".dat")
    with open(out_param_file, "w") as writer:
        writer.write(str(op_1))

# Inserted snippet writes output parameter file for web tool execution
import os
# Only run this snippet during web tool execution when env variable "ENB_JOBID" will be present
if "ENB_JOBID" in os.environ:
    out_param_name = "op_2"
    out_param_file = os.path.join(
        os.environ["ENB_JOBID"], "value_" + out_param_name + ".dat")
    with open(out_param_file, "w") as writer:
        writer.write(str(op_2))

# Inserted snippet writes output parameter file for web tool execution
import os
# Only run this snippet during web tool execution when env variable "ENB_JOBID" will be present
if "ENB_JOBID" in os.environ:
    out_param_name = "op_3"
    out_param_file = os.path.join(
        os.environ["ENB_JOBID"], "value_" + out_param_name + ".dat")
    with open(out_param_file, "w") as writer:
        writer.write(str(op_3))

 

The issue is my custom output parameter has no values returned but only the parameter name. Unlike the outputPreview default parameter which has an value associated to it:

GLIMichael_2-1754427688701.png

GLIMichael_3-1754427717881.png

 

 

the outputPreview parameter does have value:

GLIMichael_1-1754427619706.png

 

 

0 Kudos
0 Replies