I am hoping to gain a better understanding of how arcpy.Exists() interprets an ArcGIS Server (.ags) connection file (currently using ArcGIS Pro 2.8.1)
After some testing, including the .ags file extension within the string variable will return False while excluding it will return True.
import arcpy test01 = arcpy.Exists("C:\\Path\\To\\Connection\\sample_ags_file.ags") print(test01) False test02 = arcpy.Exists("C:\\Path\\To\\Connection\\sample_ags_file") print(test02) True
Could someone enlighten me as to why the .ags extension returns False? Or is it bad practice to use arcpy.Exists() when attempting to verify the existence of .ags files? I appreciate any clarification!
For "C:\\Path\\To\\Connection\\sample_ags_file", the dataType is shown as ServerConnection.
For "C:\\Path\\To\\Connection\\sample_ags_file.ags", the script errors out and says the file does not exist.
I'm assuming .ags extensions need to be excluded when using them with arcpy, but I'm unsure why that is the case if true.
Yep I can confirm it exists with that (and will likely go that route), but I'm more curious about how .ags file extensions and arcpy.Exists() interact, since I'm seeing different results with/without the extension.