Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am relatively new to ArcPy 10. and I want to return the list of feature class from a dataset. I can see them through the message, but cannot see them from the result window. Actually there are only inputs, environments and messages I can view from the results window. Am I missing something in the script? Thanks.

    import arcpy
    import json
    from arcpy import env
    featureDatasets = arcpy.ListDatasets("SDE.POINT_OF_INTEREST")
    fcList=arcpy.ListFeatureClasses("*", "ALL", fd)
    for fc in fcList:
    arcpy.AddMessage("--------Encode the list to a json string-\n")
    print layerlistEncode
    arcpy.AddMessage("--------Encode the json string to a list\n")
    print layerlistDecode
    print layerlistDecode["resource"]
    arcpy.SetParameterAsText(0, layerlistEncode)


Edit / Delete Edit Post   Reply With Quote Reply With Quote   Multi-Quote This Message  Top Bottom    
share|improve this question
Is this a script tool? How have you set up its parameters? If I'm interpreting your code correctly, parameter 0 should probably be a derived, output parameter. Is that how it is set up? – blah238 Oct 3 '12 at 20:36
Yes. It is a script tool. I just want to return the feature layer list as a JSON String for further processing in another tool. I dont set any parameter. I run this script after I add it to a toolbox, but the output is null. I also run it in the python window in ArcGIS, the outputCount is 0. – Alex Oct 3 '12 at 21:07
You need to set up a derived, output parameter for SetParameterAsText to have any effect. See the help:… – blah238 Oct 3 '12 at 21:12
Rather than running the script in the ArcMap python window, I would recommend downloading PythonWin ( to write and implement your python/arcpy scripts. This user-friendly interface will definitely help you debug your script too. Beware, that you have to download the correct build for your version of python (2.6 or 2.7). – Aaron Oct 4 '12 at 3:29
It works. That is what I didnt pay attention to when read the help file. Thanks a lot. – Alex Oct 4 '12 at 13:18
up vote 4 down vote accepted

You need to set up a derived, output parameter for SetParameterAsText to have any effect. See the help on Setting script tool parameters.


share|improve this answer
Thanks blah238. I tried what you told me and it worked. It saved me a lot of time. – Alex Oct 8 '12 at 13:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.