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 writing a script that accesses multiple sde Database connections. I have set the script to include accessing the environment workspace:

import arcpy

arcpy.GetParameterAsText(0)
arcpy.GetParameterAsText(1)

arcpy.env.workspace = r"Database Connections\somedb.sde"

do some python stuff...

arcpy.env.workspace = r"Database Connections\someOtherdb.sde"

So, I open then tool, enter my parameters and run it. When it gets to setting the workspace, I get the regular popup window to prompt me to enter my username and password to the sde database.

The problem I have it that the tool GUI runs on top of the popup. Any time I try to click on the popup window to enter my username and password, the GUI automatically pops on top again and I can't type anything.

Is there any way for me to build the GUI so that I can enter my username and password aside from using the arcpy.CreateArcSDEConnectionFile_management function? My connection files already exist, so I don't need to create new ones. I just need to log in to it.

share|improve this question

1 Answer 1

After testing I found a solution that is working for now. I just went into the validator class and set the workspace environment for both database connections to initiate on tool startup. Now, when I open the tool, I get the Database Connection login prompt to popup twice (one for each DB connection) and I can enter my login information.

Ideally though, I would like to build my ArcGIS GUI to include a string parameter for the username and an encrypted string parameter to accept the password which I would pass along to the connection file prompt. If I find a solution, I will post an answer.

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.