Python Script - Accepting RAW_Input when run in Toolbox

1028
3
Jump to solution
02-22-2021 12:14 PM
by Anonymous User
Not applicable

I have a simple Python script that accepts a Y/N response from the user before proceeding:

When I run it in PyScripter or Idle it's functioning as expected.   I'd like to import it into a toolbox and have the user run it From ArcCatalog.

When I do that I'm getting the following error:

Traceback (most recent call last):
File "\\nq-cluster1\Share-APPL\GISAppl\Data Distribution Updates\DistributeAgData\ExtractAgData3_1.py", line 37, in <module>
includeapps = raw_input("Include Ag Applicants? (Y or N):")
EOFError: EOF when reading a line

Failed to execute (Script).
Failed at Mon Feb 22 15:11:30 2021 (Elapsed Time: 0.16 seconds)

What do I need to do to configure ArcCatalog to show the input prompt to accept Y/N?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

This is correct. You'll need to add a parameter to your script tool that will present this input to the user in the geoprocessing tool window. If you specify the parameter data type as Boolean, it should show up as a simple check box.

View solution in original post

3 Replies
DavidPike
MVP Frequent Contributor

So this is a script tool?  Any parameters need to be specified with arcpy.GetParameterAsText() or similar, and configured in the script tool properties.
Setting script tool parameters—ArcGIS Pro | Documentation

#tool input parameter
#the (0) index is the first parameter of the tool
includeapps = arcpy.GetParameterAsText(0)

#logical test against argument
if includeapps == 'Y':
    blah blah blah
BlakeTerhune
MVP Regular Contributor

This is correct. You'll need to add a parameter to your script tool that will present this input to the user in the geoprocessing tool window. If you specify the parameter data type as Boolean, it should show up as a simple check box.

by Anonymous User
Not applicable

Thank you both. I've got to get better at figuring those type of things out. It was very simple. But when I don't know the solution it sometimes seems like a vast amount of information I have to search through to find the right answer. Hence I ask what ends up being a simple question with a simple answer. Thanks again.