Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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??

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

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.

share|improve this answer
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? – user1898629 Mar 11 '13 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 '13 at 22:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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