I am trying to write a script tool for my geospatial programming class and I am stuck (this is an online course and we get NO support from our instructor).

What I need to do is create buffers (different values) around three different features, these are set up as parameters that the user will define. I got this to work just fine.

Next, I need to perform a Union_analysis on those three buffer outputs, this is where I am getting stuck. I did this in a previous script, where I was using known feature classes, but I cannot figure out how to get this to recognize the outputs of the three "user selected" features.

Here is my script so far:

import arcpy

arcpy.env.overwriteOutput = True
buffered_area = "buffered_area"

# Get the input parameters for the Buffer tool
inPath = arcpy.GetParameterAsText(0) 
outPath = arcpy.GetParameterAsText(1)
bufferDistance = arcpy.GetParameterAsText(2)
inPath1 = arcpy.GetParameterAsText(3)
outPath1 = arcpy.GetParameterAsText(4)
bufferDistance1 = arcpy.GetParameterAsText(5)
inPath2 = arcpy.GetParameterAsText(6)
outPath2 = arcpy.GetParameterAsText(7)
bufferDistance2 = arcpy.GetParameterAsText(8)

# Run the Buffer tool
buffer1 = arcpy.Buffer_analysis(inPath, outPath, bufferDistance)
buffer2 = arcpy.Buffer_analysis(inPath1, outPath1, bufferDistance1)
buffer3 = arcpy.Buffer_analysis(inPath2, outPath2, bufferDistance2)

arcpy.Union_analysis("buffer1 #; buffer2 #; buffer3 #", buffered_area, "ALL", "", "GAPS")

And here is the error message I get:

Failed script Script1...

Traceback (most recent call last):
  File "\\SNHU-LABS-UTIL2.snhu-labs.com\userprofiles$\william.herzig\Documents\programming\try.py", line 29, in <module>
    arcpy.Union_analysis("buffer1 #; buffer2 #; buffer3 #", buffered_area, "ALL", "", "GAPS")
  File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\analysis.py", line 629, in Union
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset buffer1 #;buffer2 #;buffer3 # does not exist or is not supported
WARNING 000725: Output Feature Class: Dataset \\SNHU-LABS-UTIL2.snhu-labs.com\userprofiles$\william.herzig\Documents\ArcGIS\Default.gdb\buffered_area already exists.
Failed to execute (Union).

Failed to execute (Script1).

2 Answers 2


Try instead to put your list of buffered outputs into a list object. You might also set the workspace option before proceeded, otherwise ArcMap will send the output from the union to the default geodatabase.

arcpy.env.workspace = "path to output folder or geodatabase"
arcpy.Union_analysis([buffer1, buffer2, buffer3], buffered_area)

Or if you know the path is working you can use the output from the parameter.

arcpy.Union_analysis([outPath, outPath1, outPath2], buffered_area)
  • Thanks for the help, worked great!
    – Bogey-1
    Aug 5, 2019 at 17:15

buffer1, 2 and 3 are result objects not the buffer outputs. Try:

arcpy.Union_analysis([outpath, outPath1, outPath2], buffered_area, "ALL", "", "GAPS")
  • 1
    Worked like a charm, thank you!
    – Bogey-1
    Aug 5, 2019 at 17:14
  • 1
    Nice! Please accept one answer with the checkbox
    – BERA
    Aug 5, 2019 at 17:19

Your Answer

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

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