Validate connection parameters, no error on no password

Discussion created by p_d_austin on Dec 13, 2010
Latest reply on Dec 13, 2010 by clm42
I am creating a connection to a ArcGIS 9.3 server using python as shown below.

geoProcessor = arcgisscripting.create(9.3)
geoProcessor.workspace = '...\connection.sde'

I then try and do something like the following

tables = geoProcessor.ListTables("*")

At some point the user will be prompted for a username and password because the connection.sde file does not have a username or password embedded for security reasons.

If for some reason the connection file is invalid for some reason or the user presses cancel and the username and password prompt there is no error thrown when I try and list tables or feature classes. All it does is return an empty list.

So the user thinks everything is OK because the script finished without errors but in fact nothing happened.

Is there a command to validate the connection before then calling any other commands. This way I can print an error to the log that there was an error in the connection.