4

I'm trying to post a list of unique ID's (as a string) to a Python script tool for processing by ArcGIS Desktop 10.0.

The list may be 50k+ id's long (~450kb).

e.g. "237434,237435,237436,237423,237424,237425,237426"

When defining the input param for my tool, I have tried using the String, and 'Any Value' data types (different version, but described here).

The problem is: the parameter string is being truncated at 4285 Id's. I have been unable to find any info on the size restrictions of Strings passed in as tool params?

The number of Id's will be increasing over time, so I need to find a more robust way of dealing with large strings being passed in.

The obvious choice is to slice the string into digestable chunks - however, the way that multi value params are defined it appears that they must be preconfigured (I must know, or have a fixed number of chunks).

I want a dynamic solution; any suggestions?


I am able to get the Id's if I read them from a static text file, but the Id list will be a dynamic list being sent from client application for processing.

So basically I need to find a window in the tool params to get the list in.

9
  • 1
    put them in a text file (csv) and give the path to the text file as a parameter. Python lists can be VERY large so I'm thinking it's an input form restriction and not a python restriction on length. Jan 15, 2015 at 4:36
  • Thanks @MichaelMiles-Stimson, see my edits - I am able to read the id's in from a file; but it's getting them to that point that is the challenge :)
    – danwild
    Jan 15, 2015 at 4:41
  • What about multiline = true for string input. If you can break them into chunks, then one per line. How do the processes communicate? Is it via .net objects? Jan 15, 2015 at 4:43
  • You could defs be onto something with the form restriction though..I'll look into circumventing the form to see if that's the issue. Thanks
    – danwild
    Jan 15, 2015 at 4:53
  • Python will run from the command line (I do that frequently) but even command line has issues with extra long strings. You may need to investigate pipe communication if you want to communicate directly between the processes. Jan 15, 2015 at 5:00

1 Answer 1

3

As indicated by @Michael Miles-Stimson in the comments, the truncation of the input string parameter was being caused by a limitation of the input field within ArcGIS Catalog's UI.

When passing the exact same parameter in via python, the toolbox script behaved as expected.

For completeness; here's a snippet of the script using the toolbox:

# Import custom toolbox
arcpy.ImportToolbox("C:\path\to\Custom_Toolbox.tbx")

# Run tool in the custom toolbox.
# The tool is identified by: <tool name>_<tool alias>
arcpy.MyTool_Custom_Toolbox(big_string)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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