To do some advanced web map printing, I used the python script in the "Basic web map printing/exporting using arcpy.mapping" tutorial. In the python script, there is a block of code to remove all layers in the map that are service layers:
for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):
if lyr.isServiceLayer:
arcpy.mapping.RemoveLayer(df, lyr)
This mostly works, but I am finding that it does not seem to remove services that are feature services. Is there any reason for this? How can I get it to remove all services from the map, including feature services?
Thanks.