I am in the process of writing a crawler that does certain things. One of its primary tasks is to look inside mxds and layer files and find out what layers the documents has, and what datasources they point to. The ArcPy describe method is pretty much designed to just this very thing, and for the most part it does it quite well.
However, using this bit of code (below) to find an SDE or ArcGIS Server Reference works well, except if ArcPy cant find the SDE Instance or the AGS Service. At that point, ArcPy will prompt the user to input the parameters to validate the layer. This does not go over well when there is no one around to babysit the crawler.
Is there a way to make ArcPy not automatically prompt the user for input or I am not approaching this the right way?
if lyr.supports("SERVICEPROPERTIES"):
if lyr.serviceProperties["ServiceType"] == "SDE":
SDE_HOST = lyr.serviceProperties.get('Server', 'N/A').upper()
SDE_PORT = lyr.serviceProperties.get('Service', 'N/A').upper()
if lyr.serviceProperties["ServiceType"] == "MapServer":
SOURCE_PATH = lyr.serviceProperties.get('URL', 'N/A')