1

I am trying to use arctoolbox and python so that the user can enter in parameters. In my script I have the following lines

_StationInterval = arcpy.GetParameterAsText(0)

I just want the user to be able to enter in a value for the station interval. However I get the error:

<type 'exceptions.NameError'>: name '_StationInterval' is not defined
Failed to execute (Final3Test).

Before I used arctoolbox, I had the station interval set to a value in the script, i.e. _StationInterval = 10000

Am I missing something in my script??

3
  • 3
    Post the rest of your script so we can see what else is going on... Mar 8, 2013 at 21:36
  • does the error occurring at the line you posted?
    – Emi
    Mar 9, 2013 at 3:16
  • Uhm,...I think so. I mean, the arc toolbox doesn't tell me a line of where the error occurred Mar 11, 2013 at 15:14

1 Answer 1

1

Your script is probably fine but it sounds like you have not defined a Parameter for it on the Properties of your Python script tool.

The process for doing that is described here.

2
  • I have already defined and set the parameters within the properties box of arctoolbox. I'm still getting the same error. Is there some snippet of code I need to include in actual python script (other than what I've posted above) to define the parameters as well? Mar 11, 2013 at 17:47
  • If you have defined a function within your Python script and the variable is set outside of it then you may have a scoping issue. If that is the issue just pass it in as a parameter to the function.
    – PolyGeo
    Mar 11, 2013 at 22:29

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.