1

I am attempting to create a password to lock a python file for a script tool I am building out in ArcGIS Pro. I am not worried about the password being visible in the script itself, since I am able to password lock the script in ArcGIS Pro already. I have scoured the internet looking for a simple example script, but have been unable to find one because most of the posts I am seeing are concerned with encryption and security.

Does anyone know of a way to simply add a password with arcpy.GetParameterAsText() for user input?

0

1 Answer 1

3

You can assign the password parameter to a variable, then use an if statement to test the password:

pw = arcpy.GetParameterAsText()
if pw == 'your_password': 
    do stuff
    do more stuff  
else: 
    print('Incorrect Password!!!')
1
  • 1
    Don't forget the appropriate datatype GPStringHidden Commented Oct 9, 2021 at 6:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.