Hi everyone
I tried to create a python script toolbox. I tried to obtain ArcGIS parameters using both arcpy.GetParameterAsText(0) and sys.argv[1].
I think I supposed to obtain a string. but I got a tuple.
Is there any reason why this happens? My another tool works fine.
The variable I got is like this:
['C:\\Users\\dustm\\Documents\\GitHub\\TurkeyLake_Project\\Shapefiles\\Shapefiles_to_define_HRUs\\finalcat_info.shp']
['#']
['abc']
Thanks
Solved! Go to Solution.
I did a quick check/test running a script tool from within Pro, and I don't see this behavior for either single-value or multi-value input. Maybe it is how you are setting or passing the arguments, can you elaborate on how the shape file is getting passed to the script?
And, are you using the latest version of Pro?
you got a list, is by chance your parameter multivalue?
perhaps you should show the actual code and parameter definitions
Here is all my parameter definitions, there is no multi value.
you apparently have 19 parameters.... which is the parameter in question? You need to scroll to the right to see if the multivalue option is specified.
Also, if your getparameterastext is all of them, that is why it returns a list.
this is printed one parameter using arcpy.GetParameterAsText(0) .
['C:\\Users\\dustm\\Documents\\GitHub\\TurkeyLake_Project\\Shapefiles\\Shapefiles_to_define_HRUs\\finalcat_info.shp']
I did a quick check/test running a script tool from within Pro, and I don't see this behavior for either single-value or multi-value input. Maybe it is how you are setting or passing the arguments, can you elaborate on how the shape file is getting passed to the script?
And, are you using the latest version of Pro?
Hi everyone
I figure it out, it is because I add a , after each parameter assignment.
Thanks for all your help
Ming