Thanks for your suggestion; interesting that it fixes it for you. Are you using 10.1 SP1?Testing on my side with the following code, the problem persists.
import arcpy
class Toolbox(object):
def __init__(self):
self.label = "FeatureSet Output Test"
self.alias = ""
self.tools = [Test]
class Test(object):
def __init__(self):
self.label = "Test1"
self.description = "Output a few points in a feature set"
self.canRunInBackground = False
def getParameterInfo(self):
params = []
param0 = arcpy.Parameter(
displayName = "FS Output", name = "fsOutput",
datatype = "Feature Set", parameterType = "Derived", direction = "Output")
params.append(param0)
param1 = arcpy.Parameter(
displayName = "FS Output1", name = "fsOutput1",
datatype = "GPFeatureRecordSetLayer", parameterType = "Derived", direction = "Input")
params.append(param1)
param2 = arcpy.Parameter(
displayName = "FS Output2", name = "fsOutput2",
datatype = "GPFeatureRecordSetLayer", parameterType = "Derived", direction = "Output")
params.append(param2)
param3 = arcpy.Parameter(
displayName = "JSON Output", name = "strOutput",
datatype = "String", parameterType = "Derived", direction = "Output")
params.append(param3)
return params
def execute(self, parameters, messages):
gdbPath = 'in_memory'
featureClassName = 'points'
featureClass = '{}/{}'.format(gdbPath, featureClassName)
try:
arcpy.AddMessage('Creating a point feature class with 1 text attribute')
if arcpy.Exists(featureClass):
arcpy.Delete_management(featureClass)
arcpy.CreateFeatureclass_management(
out_path=gdbPath, out_name=featureClassName, geometry_type='POINT',
spatial_reference=arcpy.SpatialReference(4326))
arcpy.AddField_management(
in_table=featureClass,
field_name='Attribute1', field_type='TEXT')
arcpy.AddMessage('Inserting a couple points')
with arcpy.da.InsertCursor(featureClass, ('SHAPE@XY', 'Attribute1')) as cur:
cur.insertRow(((1, 1), 'point at 1, 1'))
cur.insertRow(((2, 2), 'point at 2, 2'))
arcpy.AddMessage('Setting the output parameters')
featureSet = arcpy.FeatureSet(featureClass)
parameters[0].value = featureSet
parameters[1].value = featureSet
parameters[2].value = featureSet
parameters[3].value = featureSet.JSON
except Exception as e:
arcpy.AddError(str(e))
Results window after running that script:[ATTACH=CONFIG]24773[/ATTACH]Hi
I had the same problem as yours
To Resolve, I used the following parameter: GPFeatureRecordSetLayer
maybe it can solve your problem:
param0 = arcpy.Parameter(
displayName = "FS Output", name = "fsOutput",
datatype = "GPFeatureRecordSetLayer", parameterType = "Derived", direction = "Intput")
Jean