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?


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  
    print('Incorrect Password!!!')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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