0

I'm trying to create a buffer as part of a code but I keep getting the following error:

ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Distance [value or field]: Value is required Failed to execute (Buffer).

I set the buffer distance in the script toolbox in ArcGIS but it doesn't seem to recognise it. Here is the code I'm using:

in_features = "Thames"
out_feature_class = "Flood_R_A"
# Run the Buffer Tool
arcpy.Buffer_analysis (in_features, out_feature_class, arcpy.GetParameterAsText(5), "FULL", "ROUND", "ALL", "")

Does anybody know what I'm doing wrong?

13
  • What do you get if you do arcpy.AddMessage(arcpy.GetParameterAsText(5))? It appears to be blank.
    – Paul
    Commented Jul 28, 2013 at 16:35
  • How are you defining your workspace?
    – Aaron
    Commented Jul 28, 2013 at 16:35
  • @Aaron, I first define my workspace using GetParameterAsText to a folder and then I create a gdb in this folder. I then do this: arcpy.ResetEnvironments() arcpy.env.workspace = "C:/Birkbeck_Python/Prog_Assign_1.gdb" to set it to the created gdb. It works fine until it hits the buffer!
    – Dunuts
    Commented Jul 28, 2013 at 16:55
  • 1
    Are you positive you are passing a value to parameter 5? It still sounds like the parameter is blank. If you don't see a message, it could be printing a blank line.
    – Paul
    Commented Jul 28, 2013 at 18:29
  • 1
    This question seems to be a continuation of an earlier one from you for which you have not yet accepted an answer.
    – PolyGeo
    Commented Jul 28, 2013 at 21:45

1 Answer 1

2

Based on your error message (and subsequent comments), I think the problem is with parameter 5 (which is actually parameter 6 because the counter starts at 0, not 1).

There are a few possibilities:

  • You are grabbing the wrong parameter or possibly no parameter at all.
  • You are failing to pass a parameter (maybe it is set as optional).
  • You are passing an invalid paramater.

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