SaveToLayerFile_management accepts only features save on disk

Discussion created by ranam80 on Jun 6, 2013
Latest reply on Jun 10, 2013 by ranam80
I'm trying to use SaveToLayerFile_management to save layers (in an mxd) pointing to features in the server "Internet", but it doesn't work

When I use ArcToolbox (SaveToLayerFile) it doesn't work neither. However, I can save it manually by right-clocking on the feature and save it as...

Is there a Python command that allowes me to save such layers? If it's not possible, how can I skip those layers and save the rest of the layers in the mxd file?

This is my code:
    for lyr in lyrs:
        l_name = lyr.longName
        layer_name = l_name.replace("_"," ")
        layer_name = layer_name.replace("\\","_")
        arcpy.SaveToLayerFile_management(lyr,ws + '\\' + layer_name + '.lyr', "RELATIVE")
Thank you