<?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: arcpy SaveToLayerFile creates invalid file in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224837#M61467</link>
    <description>&lt;P&gt;your exact code is working fine in Pro 2.9.3 for me as long as&amp;nbsp;&lt;SPAN&gt;E:\\_Projects\\sample.gdb\\test actually exists and is valid.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2022 19:22:03 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2022-10-24T19:22:03Z</dc:date>
    <item>
      <title>arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224769#M61457</link>
      <description>&lt;P&gt;I'm using ArcGIS Pro 3.02 and Python 3.9 to create a feature layer and save the layer to a lyrx file. This generates an invalid file error message ("The selected layer file is not valid") when I attempt to add the lyrx to a map. Results are the same whether I run it as a stand-alone script or from the Python window in Pro.&lt;/P&gt;&lt;P&gt;This is the code:&lt;/P&gt;&lt;P&gt;# input polygon feature class&lt;BR /&gt;infeatures = "E:\\_Projects\\sample.gdb\\test"&lt;BR /&gt;maplayer = 'test'&lt;BR /&gt;layerfile = "E:\\Layers\\Test.lyrx"&lt;BR /&gt;arcpy.management.MakeFeatureLayer(infeatures, maplayer)&lt;BR /&gt;arcpy.management.SaveToLayerFile(maplayer, layerfile, 'ABSOLUTE')&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Pam&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 16:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224769#M61457</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-24T16:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224827#M61462</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;Checked in 3.1 (this is not an issue).&amp;nbsp; Are you able to share an empty table.&amp;nbsp; (Maybe there is something special in you data?)&lt;BR /&gt;&lt;BR /&gt;To create an empty feature:&lt;BR /&gt;1. Select Layer By Attribute where ObjectId = -1&lt;BR /&gt;2. Copy Features&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 19:05:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224827#M61462</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2022-10-24T19:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224828#M61463</link>
      <description>&lt;P&gt;in immediate mode, did you try&lt;/P&gt;&lt;LI-CODE lang="python"&gt;infeatures = "E:\\_Projects\\sample.gdb\\test"
layerfile = "E:\\Layers\\Test.lyrx"
arcpy.management.SaveToLayerFile(infeatures, layerfile, 'ABSOLUTE')&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/save-to-layer-file.htm" target="_blank"&gt;Save To Layer File (Data Management)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 19:06:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224828#M61463</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-10-24T19:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224835#M61465</link>
      <description>&lt;P&gt;Also, checked in 3.0 no issue with the above script.&amp;nbsp; (Would be insiteful too if you did get the path to work and not the layerName)&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 19:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224835#M61465</guid>
      <dc:creator>JonathanNeal</dc:creator>
      <dc:date>2022-10-24T19:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224837#M61467</link>
      <description>&lt;P&gt;your exact code is working fine in Pro 2.9.3 for me as long as&amp;nbsp;&lt;SPAN&gt;E:\\_Projects\\sample.gdb\\test actually exists and is valid.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 19:22:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224837#M61467</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2022-10-24T19:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224868#M61470</link>
      <description>&lt;P&gt;Hmm. The script works in immediate mode (iPython). I still get an 'invalid file' when loading the same code in the Python window and running it from there.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 20:35:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224868#M61470</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-24T20:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224872#M61471</link>
      <description>&lt;P&gt;The path and feature class are valid. They work fine with other commands.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 20:39:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224872#M61471</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-24T20:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224929#M61478</link>
      <description>&lt;P&gt;Sounds strangely like&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDExNzQ0NQ==" target="_blank"&gt;BUG-000117445: The Save To Layer File management tool fails and ret.. (esri.com)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;which you seem to have tried the workaround&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2022 21:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1224929#M61478</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-10-24T21:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy SaveToLayerFile creates invalid file</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1226164#M61627</link>
      <description>&lt;P&gt;Thanks Dan. I'm currently dead in the water for running any of my scripts with Pro because I can't resolve the 'no module named arcpy' error that pops up every week.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 14:41:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-savetolayerfile-creates-invalid-file/m-p/1226164#M61627</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-10-27T14:41:32Z</dc:date>
    </item>
  </channel>
</rss>

