<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SaveToLayerFile_management accepts only features save on disk in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309378#M24134</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;use the Try...Except&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Code will enter the try block and attempt to execute. If an error occurs, the try block execution is stopped, and transferred to the exception block. The exception can be coded to simply move on to the next item in the list if you wish.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Jun 2013 14:44:03 GMT</pubDate>
    <dc:creator>JimCousins</dc:creator>
    <dc:date>2013-06-07T14:44:03Z</dc:date>
    <item>
      <title>SaveToLayerFile_management accepts only features save on disk</title>
      <link>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309377#M24133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in lyrs:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_name = lyr.longName
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer_name = l_name.replace("_"," ")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layer_name = layer_name.replace("\\","_")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SaveToLayerFile_management(lyr,ws + '\\' + layer_name + '.lyr', "RELATIVE")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 10:20:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309377#M24133</guid>
      <dc:creator>RanaMahmoud</dc:creator>
      <dc:date>2013-06-06T10:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: SaveToLayerFile_management accepts only features save on disk</title>
      <link>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309378#M24134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;use the Try...Except&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Code will enter the try block and attempt to execute. If an error occurs, the try block execution is stopped, and transferred to the exception block. The exception can be coded to simply move on to the next item in the list if you wish.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 14:44:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309378#M24134</guid>
      <dc:creator>JimCousins</dc:creator>
      <dc:date>2013-06-07T14:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: SaveToLayerFile_management accepts only features save on disk</title>
      <link>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309379#M24135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Jim, that should do it...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 13:10:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/savetolayerfile-management-accepts-only-features/m-p/309379#M24135</guid>
      <dc:creator>RanaMahmoud</dc:creator>
      <dc:date>2013-06-10T13:10:55Z</dc:date>
    </item>
  </channel>
</rss>

