<?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: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle() in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1038819#M60497</link>
    <description>&lt;P&gt;is your script attached to a tool in arctoolbox when you are running it?, because you are using 'CURRENT' as the project.&amp;nbsp; That is why it works in the python window.&amp;nbsp; Toss in a few print statements to catch the name of the project (p) and the lyr name to make sure they are correct&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 19:36:51 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-03-19T19:36:51Z</dc:date>
    <item>
      <title>Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1038747#M60492</link>
      <description>&lt;P&gt;I've been working on a geoprocessing script that will use the&lt;STRONG&gt; Match Symbology to A Style Tool&lt;/STRONG&gt;. Unfortunatley every time the script reaches the line where I call the tool, Pro crashes.&lt;/P&gt;&lt;P&gt;Interestingly, if I use the same line of code in the python window it works correctly. Anyone else run into this issue before?&lt;/P&gt;&lt;P&gt;Here is the code up to that point:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;arcpy&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'''Set Parameters'''&lt;BR /&gt;&lt;/SPAN&gt;map_name = arcpy.GetParameterAsText(&lt;SPAN&gt;0&lt;/SPAN&gt;)&lt;BR /&gt;retail_layer = arcpy.GetParameterAsText(&lt;SPAN&gt;1&lt;/SPAN&gt;)&lt;BR /&gt;symbol_param = arcpy.GetParameterAsText(&lt;SPAN&gt;2&lt;/SPAN&gt;)&lt;BR /&gt;label_opt = arcpy.GetParameterAsText(&lt;SPAN&gt;3&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;p = arcpy.mp.ArcGISProject(&lt;SPAN&gt;'CURRENT'&lt;/SPAN&gt;)&lt;BR /&gt;m = p.listMaps(map_name)[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;lyr = m.listLayers(retail_layer)[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;&lt;BR /&gt;rows = arcpy.SearchCursor(lyr)&lt;BR /&gt;names = [row.Name &lt;SPAN&gt;for &lt;/SPAN&gt;row &lt;SPAN&gt;in &lt;/SPAN&gt;rows]&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;'''Update the layer to unique values by name''&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;arcpy.management.MatchLayerSymbologyToAStyle(lyr, "$feature.ChainName", r"C:\Desktop\Logos.stylx")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 17:35:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1038747#M60492</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-19T17:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1038819#M60497</link>
      <description>&lt;P&gt;is your script attached to a tool in arctoolbox when you are running it?, because you are using 'CURRENT' as the project.&amp;nbsp; That is why it works in the python window.&amp;nbsp; Toss in a few print statements to catch the name of the project (p) and the lyr name to make sure they are correct&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 19:36:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1038819#M60497</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-19T19:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1039739#M60535</link>
      <description>&lt;P&gt;Thanks for the reply Dan. I need to access the project like that in order to interact with the CIM. There's a portion of the tool where symbols are resized based on other parameters so unless there is a resize tool I believe I need to get into it that way.&lt;/P&gt;&lt;P&gt;I did try removing that portion of the script so that it was just running the Match Symbology to a Style Tool via the script and that still caused the program to crash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* EDIT: I just tried adding in a portion to update the renderer of the layer prior to the Match Symbology tool. It still crashed.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 13:16:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1039739#M60535</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-23T13:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1039744#M60536</link>
      <description>&lt;P&gt;The crashes are probably the result of putting the application in an unstable state.&amp;nbsp; There are warnings in the CIM introduction&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_blank"&gt;Python CIM access—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and guidance as to what should and should not be done.&amp;nbsp; Unless you can narrow down you case so it fits within the boundaries of what is permissable in the guidelines then what you want to do may not be possible at this time.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 13:27:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1039744#M60536</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-23T13:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1039865#M60537</link>
      <description>&lt;P&gt;Thanks again Dan.&lt;/P&gt;&lt;P&gt;I think it has to do with the tool. I removed any cim related info and the tool still crashed.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 17:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1039865#M60537</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-23T17:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1040013#M60540</link>
      <description>&lt;P&gt;This tool doesn't seem to have the standalone script syntax &lt;EM&gt;arcpy.MatchLayerSymbologyToAStyle_management()&lt;/EM&gt; that the other tools have and the example (&lt;SPAN&gt;arcpy.management.MatchLayerSymbologyToAStyle() &lt;/SPAN&gt;) is for immediate mode so I wonder- is there a standalone syntax for the tool?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 02:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1040013#M60540</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-24T02:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Tool Crashes Pro when it reachesarcpy.management.MatchLayerSymbologyToAStyle()</title>
      <link>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1040147#M60542</link>
      <description>&lt;P&gt;Thanks for the reply Jeff. I noticed that as well. Tried to use the&amp;nbsp;&lt;EM&gt;arcpy.MatchLayerSymbologyToAStyle_management() &lt;/EM&gt;syntax hoping it might work but had no luck.&lt;/P&gt;&lt;P&gt;I also tried importing the arcpy.management module&amp;nbsp; as DM and referncing that with&amp;nbsp;&lt;EM&gt;DM.MatchLayerSymbologyToAStyle()&amp;nbsp;&lt;/EM&gt;but had no luck with that either.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 12:55:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/tool-crashes-pro-when-it-reachesarcpy-management/m-p/1040147#M60542</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-24T12:55:54Z</dc:date>
    </item>
  </channel>
</rss>

