Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using arcpy 10.0, python and arctoolbox. I have a question regarding the parameters for the arc toolbox. In my script I have a function that does a check on an input file. The user is charged with selecting the appropriate input file. Say, if they select a shapefile instead of a text file, they get an error. A box pops up saying they chose the wrong input file. At that point, the script just stops and the input parameters box has alos gone away. Is there a way to make the input parameters box appear again on erroneous user input? So instead of running the program again on the users error, the input parameters box automatically reappears so the user can enter in a correct input file. Any knowledge on the subject would be greatly appreciated. Thanks.

share|improve this question

1 Answer 1

You could just set up your input parameter definitions appropriately (on your script tool's Properties->Parameters tab set the Data Type of the desired parameter to 'Shapefile' if that is what you want them to be able to input) and let the geoprocessing framework handle the validation for you.

Based on your previous question it sounds like you are attempting to use a custom dialog box to perform validation messaging. This is exactly what Customizing Script Tool Behavior and the ToolValidator class is for. I strongly advise you use this instead of whatever else you are doing.

See also: Prompt for user input during ArcGIS python script execution

share|improve this answer

Your Answer

 
discard

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.