I am new to python so please bear with me. I have the following script that is supposed to get a multivalue parameter of several shapefiles as an input and then run the unionanalysis on all these shapefules to create a single feature class or shapefile output. The script seems to run fine however only processes up to step 2 of 16 and does not create any output file. I do have the output file specified however and all the parameters are in the right order with the input accepting multivalue variables and both having feature class as their data type. I need to precise that this is within the ModelBuilder framework...

Here is the script:

    import arcpy

    myList = arcpy.GetParameterAsText(0)

    unionResult = arcpy.GetParameterAsText(1)
    arcpy.Union_analysis(myList, unionResult, "ALL", "", True)

To further clarify:

Parameter (0) is an input, feature class, multivalue (yes) Parameter (1) is an output, feature class, multivalue (No)


I think that you should split the string variable in order to get a list:

myList = arcpy.GetParameterAsText(0).split(";")

A thread at the ESRI forum here reports that spaces in the path can produce an error, so you can .strip("'") the extra single quotes around the file path.

myList = [x.strip("'") for x in myList]

In addition, check the Union_analysis parameters. The cluster_tolerance is a linear unit, so it has to be something like this:

arcpy.Union_analysis(myList, unionResult, "ALL", 0.0003, True)
  • I tried this and I got an error (which is better than the nothing I was getting before). So the error states – user32882 Aug 31 '14 at 12:41
  • What the error states ? – Hristo Tomov Aug 31 '14 at 13:09
  • i.imgur.com/5SIWvg9.png?1 – user32882 Aug 31 '14 at 13:15
  • "Parameters are not valid" – user32882 Aug 31 '14 at 13:22
  • 1
    @user32882 If you wish to pursue the "Parameters are not valid" error it could be worth researching/asking it separately so that this Q&A remains focussed on your original problem. – PolyGeo Aug 31 '14 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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